c语言 输入一个班级某门课程的成绩存入数组,将不及格的同学改为及格,其它同学每人加10分后输出全班成绩

如题所述

设有20人。

#include "stdio.h"
#define N 20
int main(int argv,char *argc[]){
int a[N],i;
printf("Please enter the %d students scores...\n",N);
for(i=0;i<N;i++){
while(scanf("%d",a+i)!=1 || a[i]<0 || a[i]>100)
printf("Input error, redo: ");
a[i]>=60 ? a[i]+=10 : a[i]=60;
}
printf("The revised points are as follows:\n");
for(i=0;i<N;printf("%4d",a[i++]));
printf("\n");
return 0; 
}

运行样例:

温馨提示:答案为网友推荐,仅供参考