C PROGRAM TO PASS WHOLE 2-D ARRAY TO A FUNCTION

/*PROGRAM TO PASS WHOLE 2-D ARRAY TO A FUNCTION*/   #include<stdio.h> #include<conio.h> void fun(int[][],int,int); void main() { int a[2][3]={1,2,3,4,5,6},i,j; clrscr(); fun(a,2,3); printf(“\n\n\n”); for(i=0;i<2;i++) { for(j=0;j<3;j++) { printf(” \n NEW ARRAY\t a%d%d=%d”,i,j,a[i][j]); } } getch(); }   void fun(int x[][3],int m,int n) { int i,j; for(i=0;i<m;i++) { for(j=0;j<n;j++) { printf(“\ta%d%d=%d”,i,j,x[i][j]); x[i][j]+=x[i][j]; } } } 211 total views,…

211 total views, no views today

Read More

C PROGRAM TO PASS A WHOLE 2-D ARRAY TO A FUNCTION

/*PROGRAM TO PASS A WHOLE 2-D ARRAY TO A FUNCTION*/     #include<stdio.h> #include<conio.h>   void fun(int[][],int,int); void main() { int a[][2]={{1,2},{3,4}}; clrscr(); fun(a,2,2); getch(); }   void fun(int x[][2],int m,int n) { int i,j; for(i=0;i<m;i++) { for(j=0;j<n;j++) { printf(“\ta%d%d=%d”,i,j,x[i][j]); } } } 171 total views, no views today

171 total views, no views today

Read More

C PROGRAM TO READ AND PRINT A 3-D ARRAY

/* PROGRAM TO READ AND PRINT A 3-D ARRAY */   #include<stdio.h> #include<conio.h> void main() { int a[2][2][2],i,j,k; clrscr();   for(i=0;i<2;i++) { for(j=0;j<2;j++) { for(k=0;k<2;k++) { printf(“\n\t enter a[%d][%d][%d]=”,i,j,k); scanf(“%d”,&a[i][j][k]); } } }   for(i=0;i<2;i++) { for(j=0;j<2;j++) { for(k=0;k<2;k++) { printf(“\n\t a[%d][%d][%d]=%d”,i,j,k,a[i][j][k]); } } }   getch();   } 147 total views, no views today

147 total views, no views today

Read More

C PROGRAM TO SORT THE ELEMENTS OF AN ARRAY IN ASCENDING ORDER

/*PROGRAM TO SORT THE ELEMENTS OF AN ARRAY IN ASCENDING ORDER*/   #include<stdio.h> #include<conio.h> void main() { int a[10],i,n,j,t,k; clrscr(); printf(“\nSize of Matrix: “); scanf(“%d”,&n);   for(i=0;i<n;i++) { printf(“Enter element %d: “,i+1); scanf(“%d”,&a[i]); }   for(i=0;i<n;i++) { for(j=0;j<n-i-1;j++) { if(a[j]>a[j+1]) { t=a[j]; a[j]=a[j+1]; a[j+1]=t; } } }   printf(“\n Sorted elements are: \n”); for(i=0;i<n;i++) printf(“\t%d”,a[i]);…

155 total views, no views today

Read More

C PROGRAM TO CHECK WHETHER A MATRIX IS SKEW SYMMETRIC OR NOT

/*PROGRAM TO CHECK WHETHER A MATRIX IS SKEW SYMMETRIC OR NOT */   #include<stdio.h> #include<conio.h> void main() { int a[3][3],b[3][3],i,j; clrscr();   for(i=0;i<3;i++) { for(j=0;j<3;j++) { printf(“\nEnter a%d%d= “,i,j); scanf(“%d”,&a[i][j]); } }   for(i=0;i<3;i++) { for(j=0;j<3;j++) { if(a[i][j]==-a[j][i]) continue; else { printf(“Matrix is not skew symmetric”); getch(); exit(0); } } } printf(“\nThe Matrix is Skew…

243 total views, no views today

Read More

C Program To Check Whether The Matrix is Symmetric or Not

/*PROGRAM TO CHECK WHETHER A MATRIX IS SYMMETRIC OR NOT */   #include<stdio.h> #include<conio.h> void main() { int a[3][3],i,j; clrscr();   for(i=0;i<3;i++) { for(j=0;j<3;j++) { printf(“Enter a[%d][%d]=”,i,j); scanf(“%d”,&a[i][j]); } }   for(i=0;i<3;i++) { for(j=0;j<3;j++) { if(a[i][j]==a[j][i]) continue; else { printf(“\n The matrix is not symmetric “); } } } printf(“\nThe matrix is symmetric”); getch(); }…

217 total views, no views today

Read More

C PROGRAM TO FIND THE TRANSPOSE OF A MATRIX

/*PROGRAM TO FIND THE TRANSPOSE OF A MATRIX*/   #include<stdio.h> #include<conio.h> void main() { int a[3][3],b[3][3],i,j; clrscr();   for(i=0;i<3;i++) { for(j=0;j<3;j++) { printf(“Enter a%d%d= “,i,j); scanf(“%d”,&a[i][j]); } }   for(i=0;i<3;i++) { for(j=0;j<3;j++) { b[j][i]=a[i][j]; } }   printf(“\n THE TRANSPOSE OF MATRIX \n”); for(i=0;i<3;i++) { for(j=0;j<3;j++) { printf(“\tb%d%d=%d”,i,j,b[i][j]); } printf(“\n”); } getch(); } 161 total views,…

161 total views, no views today

Read More