You are on page 1of 2

/* Programme to read and write a matrix */ #include<stdio.h> #include<conio.

h> void main() { int i,j,a[10][10],r,c; printf("\nenter number of rows and columns"); scanf("\n%d%d",&r,&c); printf("enter the elements of matrix"); for(i=0;i<r;i++) { printf("\n"); for(j=0;j<c;j++) { scanf("\n%d",&a[i][j]); } printf("\n"); } printf("\nentered matrix is"); for(i=0;i<r;i++) { printf("\n"); for(j=0;j<c;j++) { printf("%d\t",a[i][j]);

} printf("\n"); } getch(); }

OUTPUT

enter the number of rows and columns2 2 enter the elements of matrix 1234

entered matrix is 1 3 2 4

You might also like