C Program to Find Smallest and Largest Integer Among 5 Integer Values Using Array
Code:
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.. :)#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();
}
Categories:
c program
1 comments:
Thanks...
Post a Comment