#include<stdio.h> int main(void) { int count,i,n; double grade,total;/*定义双精度浮点型实数*/ printf("Enter n:"); scanf("%d",&n); total=0;/*对total初始值赋为0*/ count=0;/*对count初始值赋为0*/ for(i=1;i<=n;i++){/*循环*/ printf("Enter grade#%d:",i); scanf("%lf",&grade); total=total+grade;/*对total重新赋值*/ if(grade>=60){/*判断当grade大于等于60时*/ count++;/*count+1*/ } } printf("Grade average=%.2f ",total/n);/*输出成绩的平均值*/ printf("Number of success=%d ",count);/*输出及格的人数*/ return 0; }