C Program to Find Smallest Element From mxn Matrix

Question: Write a program in C to read m x n matrix and find smallest element from matrix.


#include<stdio.h>


int main()
{
 int i,j,m,n;
 float a[10][10], sm;
 clrscr();
 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]);
  }
 }
 sm = a[0][0];
 for(i=0;i< m;i++)
 {
  for(j=0;j< n;j++)
  {
   if(a[i][j]< sm)
   {
    sm = a[i][j];
   }
  }
 }
 printf("Smallest = %f\n", sm);

}