C Program to Read & Display mxn Matrix in Matrix Form


Question: Write a program in C to read m x n matrix and display the content in matrix form.

Reading & Displaying M by N Matrix in C


#include<stdio.h>

int main()
{
 int i,j,m,n;
 float a[10][10];

 printf("Enter row and column size:\n");
 scanf("%d%d", &m, &n);

 printf("Enter matrix elements:\n");
 for(i=0;i< m;i++)
 {
  for(j=0;j< n;j++)
  {
   printf("a[%d][%d]=",i,j);
   scanf("%f", &a[i][j]);
  }
 }

 printf("Matrix read is:\n");
 for(i=0;i< m;i++)
 {
  for(j=0;j< n;j++)
  {
   printf("%f\t",a[i][j]);
  }
  printf("\n");
 }

}