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

2025-02-24 16:26:23
推荐回答(1个)
回答1:

设有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 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 printf("\n");
return 0; 
}

运行样例: