#include<stdio.h>
#include<conio.h>
main()
{
long int n, i, max, a[9999], min;
printf("how many number?");
scanf("%d", &n);
for (i = 0; i<n; i++)
{
printf("Enter numbers:");
scanf("%d", &a[i]);
}
max =a[0];
min =a[0];
for (i=0; i<n; i++)
{
if(a[i]>max)
max = a[i];
else if(a[i]<min)
min = a[i];
else;
}
printf("the greatest number = %d\n", max);
printf("the smallest number = %d",min);
fflush(stdin);
getchar();
}
#include<conio.h>
main()
{
long int n, i, max, a[9999], min;
printf("how many number?");
scanf("%d", &n);
for (i = 0; i<n; i++)
{
printf("Enter numbers:");
scanf("%d", &a[i]);
}
max =a[0];
min =a[0];
for (i=0; i<n; i++)
{
if(a[i]>max)
max = a[i];
else if(a[i]<min)
min = a[i];
else;
}
printf("the greatest number = %d\n", max);
printf("the smallest number = %d",min);
fflush(stdin);
getchar();
}
0 comments:
Post a Comment