#include<stdio.h>
int main(){
int a,b,c,d;
printf("请分别输入你得四科成绩,并以逗号隔开:\n");
scanf("%d,%d,%d,%d",&a,&b,&c,&d );
int min,max;
min = max = a;
if(b < min){//b < a
min = b;
}else if(b > max){//b > a
max = b;
}
if(c < min){//c < b
min = c;
}else if(c > max){//c > b
max = c;
}
if(d < min){//d < c
min = d;
}else if(d > max){//d > c
max = d;
}
printf("min=%d,max=%d\n",min,max);
return 0;
} |
|