Use of Matrix in C


 #include<stdio.h>

int main(){

int a[10][10],m,n,i,j;

printf(" Enter the numbers of columns");       

scanf("%d",&m);

printf("enter the number of rows");

scanf("%d",&n);

if((m>0)&&(m<11)&&(n>0)&&(n<11))

{

for(i=0;i<m;i++)

{

for(j=0;j<n;j++)

{

printf("Enter the %d %d elements=",i,j);

scanf("%d",&a[i][j]);

}

}

printf("transpose matrix: \n");

for(j=0;j<n;j++)

{

for(i=0;i<m;i++)

{

printf("%d",a[i][j]);

}

printf("\n");

}

}

else

{

printf("invalid input");

}

return 0;

}

Output:-



Post a Comment

0 Comments