[My site ]
Main » 2013 » December » 13 » 2008-2009 question 4
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;
}
Category: C Programming - 1 | Views: 511 | Added by: ahansaary | Rating: 0.0/0
Total comments: 0
Only registered users can add comments.
[ Sign Up | Login ]