C program source code to Print a Matrix.
/*Print Matrix*/
/*mechatrofice*/
#include <stdio.h>
#include <conio.h> void main() { int a[10][10],i,j,m,n; clrscr(); printf("Matrix\nEnter the no of rows="); scanf("%d",&m); printf("Enter the no of columns="); scanf("%d",&n); printf("Enter the matrix element\n"); for(i=0;i<m;i++){ for(j=0;j<n;j++){ scanf("%d",&a[i][j]); }} printf("Entered Matrix\n"); for(i=0;i<m;i++){ for(j=0;j<n;j++){ printf("\t%d\t",a[i][j]); } printf("\n"); } getch(); } |
---|
Output