3-2

#include<stdio.h>
int main (void)
{
    int count,i,n;
    double grade,total;

    printf("Enter n:");
    scanf("%d",&n);
    total=0;
    count=0;
    for(i=1;i<=n;i++){
        printf("Enter grade#%d:",i);
        scanf("%Lf",&grade);
        total=total+grade;
        if(grade>=60){
            count++;
        }
    }
    printf("Grade average=%.2f\n",total/n);
    printf("Number of failures=%d\n",count);
    
    return 0;
}

posted @ 2013-10-21 00:19  傻子疯子捏子  阅读(94)  评论(0编辑  收藏  举报