C Program to Find the Smallest Number from the given Numbers using Array


SOURCE CODE:
#include<stdio.h>
#include<conio.h>
void main()
{
 int a[5],n,i,small;
 clrscr();
 printf("Enter the total number of values:");
 scanf("%d",&n);
 for(i=0;i<n;i++)
 {
 printf("\nEnter a[%d]=",i);
 scanf("%d",&a[i]);
 }
 small=a[0];
 for(i=1;i<n;i++)
 {
  if(small>a[i])
  small=a[i];
 }
 printf("\nSmallest Number is %d",small);
 getch();
}
Previous
Next Post »

Still not found what you are looking for? Try again here.