#include<stdio.h>
#include<conio.h>
int main()
{
int a[5], i, smallestNo, biggestNo, *p;
clrscr();
p = &a[0];
printf("Enter Any 5 Numbers: \n");
for(i=0;i<5;i++,p++)
scanf("%d",p);
p = &a[0];
smallestNo = *p;
biggestNo = *p;
for(i=0;i<5;i++,p++)
{
if(*p<smallestNo)
smallestNo = *p;
if(*p>biggestNo)
biggestNo = *p;
}
printf("\n Smallest Number is %d ",smallestNo);
printf("\n Biggest Number is %d ",biggestNo);
getch();
}
To Compile Press Alt+f9
To Run Press Ctrl+f9
Output:
#include<conio.h>
int main()
{
int a[5], i, smallestNo, biggestNo, *p;
clrscr();
p = &a[0];
printf("Enter Any 5 Numbers: \n");
for(i=0;i<5;i++,p++)
scanf("%d",p);
p = &a[0];
smallestNo = *p;
biggestNo = *p;
for(i=0;i<5;i++,p++)
{
if(*p<smallestNo)
smallestNo = *p;
if(*p>biggestNo)
biggestNo = *p;
}
printf("\n Smallest Number is %d ",smallestNo);
printf("\n Biggest Number is %d ",biggestNo);
getch();
}
To Compile Press Alt+f9
To Run Press Ctrl+f9
Output: