printf("输出4科成绩数,以逗号分\n");
int score1,score2,score3,score4;
score1 =score2 =score3 =score4 =0;
scanf("%d,%d,%d,%d",&score1,&score2,&score3,&score4);
int MaxScore,MinScore;
MaxScore=MinScore=0;
MaxScore = ((score1>score2 ? score1:score2)>score3 ? (score1>score2 ? score1:score2) :score3)>score4 ? ((score1> score2 ? score1:score2)>score3 ? (score1>score2 ? score1:score2) :score3) :score4;
MinScore = score1<score2 ? score1:score2<score3 ? score1<score2 ? score1:score2 :score3<score4 ? score1<score2 ? score1:score2<score3 ? score1<score2 ? score1:score2 :score3 :score4;
printf("最高分是%d,最低分是%d\n",MaxScore,MinScore); |