0:19 AM 2008-2009 question 4 |
max and min value for n = ten times
#include"stdio.h"
main()
{
int n, val, max, min, i;
n=10;
printf("enter value no. 1 : ");
scanf("%d", &val);
max=val;
min=val;
for(i=2;i<=n;i++){
printf("enter value no. %d : ", i);
scanf("%d", &val);
if(val>max)
max=val;
else if(val<min)
min=val;
}
printf("max = %d , min = %d", max, min);
getch();
return 0;
}
|
|
Total comments: 0 | |