My Project - Video Waker Alarm
Get Video alarm on Google Play

c program to find smallest (minimum) number in array


c program to find smallest (minimum) number in array Array is a collection of similar types of elements. We can find minimum or maximum element in an array by using comparison operator. i.e traversing all the elements and comparing these elements pair wise one by one. You can also find c program for array or matrix operation.

c program to find smallest (minimum) number in array

#include<stdio.h>
#include<conio.h> 

int main()
{
     int mat[20];
     int s,min;
     printf("\nSize of your Array is : ");
     scanf("%d",&s);
     printf("\nEnter your %d element of an array : ", s);

    for(int i=0;i<s;i++)
     {
          scanf("%d",&mat[i]);
     }

     min=mat[0];
     for(int i=1;i<s;i++)
     {
          if(min>mat[i])
          min=mat[i];
     }

     printf("\n minimum element is from given %d element is : %d",min);
     getch();
     return 0;
}

Output of c program to find smallest (minimum) number in array :

c program to find smallest (minimum) number in array
c program to find the min element in array