#include <stdio.h>
int main(int argc, const char * argv[]) {
float score1,score2,score3,score4,max,min; score1=score2=score3=score4=max=min=0.0; printf("输入四科成绩:\n"); scanf("%f%f%f%f",&score1,&score2,&score3,&score4); printf("成绩分别是:%.2f,%.2f,%.2f,%.2f\n",score1,score2,score3,score4);
max = ((score1>score2?score1:score2)>score3?(score1>score2?score1:score2):score3)>score4?((score1>score2?score1:score2)>score3?(score1>score2?score1:score2):score3):score4; printf("最高分:%.2f\n",max);
min = ((score1<score2?score1:score2)<score3?(score1<score2?score1:score2):score3)<score4?((score1<score2?score1:score2)<score3?(score1<score2?score1:score2):score3):score4; printf("最低分:%.2f\n",min);
printf("平均分:%.2f\n",(score1+score2+score3+score4)/4);
return 0; }
|