February 14, 2011

C Program to Find Smallest and Largest Integer Among 5 Integer Values Using Array

C Program to Find Smallest and Largest Integer Among 5 Integer Values Using Array

Code:
//C Program to Find Largest & Smallest Number out of 5 Number Using Array
#include <stdio.h>
#include <conio.h>
void main()
{
int a[5],i,big,low;
clrscr();
printf("Enter 5 Number\n\n");
for(i=0;i<5;i++)
scanf("%d",&a[i]);
big=a[0];
for(i=0;i<5;i++)
{
if(a[i]>big)
big=a[i];
else
if(a[i]<low)
low=a[i];
}
printf("\nLargest Number is=%d\nSmallest Number is=%d ",big,low);
getch();
}

Hope you liked my posts, give comments if you have any doubts.. :)

Related Posts :



Categories:

1 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Related Posts with Thumbnails