Code In Tech - The Ultimate World of Computer Technology

Saturday 24 March 2012

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();
}

No comments :

Post a Comment