#include <stdio.h> int main() { int _score1=0; int _score2=0; int _score3=0; int _score4=0; int _maxScore=0; int _minScore=0; printf("请输入学生的成绩,以‘,’分开\n"); scanf("%d,%d,%d,%d",&_score1,&_score2,&_score3,&_score4);
_maxScore=_score1; _minScore=_score1;
if (_score2>_score1) { _maxScore=_score2; }else{ _minScore=_score2; }
if(_score3>_score1){ _maxScore=_score3; }else{ _minScore=_score3; }
if(_score4>_score1){ _maxScore=_score4; }else{ _minScore=_score4; } printf("最高分是:%d\n",_maxScore);
printf("最低分是:%d",_minScore); return 0; }
|