Posted in 面试题 onSeptember 01, 2016
double find(int total, int n) {
int number, score, average;
scanf(“%d”, &number);
if(number != 0) {
scanf(“%d”, &score);
average = find(total+score, n+1);
if(score >= average)
printf(“%d:%d\n”, number, score);
return average;
} else {
printf(“Average=%d\n”, total/n);
return total/n;
}
}
int main(int argc, char* argv[]) {
find(0, 0);
}
int number, score, average;
scanf(“%d”, &number);
if(number != 0) {
scanf(“%d”, &score);
average = find(total+score, n+1);
if(score >= average)
printf(“%d:%d\n”, number, score);
return average;
} else {
printf(“Average=%d\n”, total/n);
return total/n;
}
}
int main(int argc, char* argv[]) {
find(0, 0);
}
求高于平均分的学生学号及成绩
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Tags in this post...
Reply on: @reply_date@
@reply_contents@