#include<conio.h>
#include<stdio.h>
void main()
{
clrscr();
int a[20],k,x=0,i,p=0;
printf(" How many no. to be entered ? ");
scanf("%d",&k);
printf("\n\tEnter no. ");
for(i=0;i<k;i++)
{
scanf(" %d",&a[i]);
}
for(i=0;i<k;i++)
{
if(a[0]>a[i])
{
a[0]=a[i];
p=a[0];
}
}
for(i=0;i<k;i++)
{
if(a[0]<a[i])
{
a[0]=a[i];
x=a[0];
}
}
printf(" Smallest no. is %d and Largest no. is %d",p,x);
getch();
}
No comments:
Post a Comment
Please write your doubts