实验7(4)编写程序,输入一批学生的成绩,遇0或负数则输入结束,要求统计并输出优秀(大于85)、通过(60~84)和不及格(小于60)的学生人数。

#include<stdio.h>
int main(void)
{
    int a,b,c,h;
    printf("Enter h:");
    scanf("%d",&h);
    if(h>84){
        a++;
    }
    else if((h>=60)&&(h<=84)){
        b++;
    }
    else if((h<60)&&(h>0)){
        c++;
    }
    else(h<0){
        printf("error");
    }
    printf("%d%d%d\n",a,b,c);

 

posted @ 2013-10-31 09:53  涅墨西斯  阅读(895)  评论(1编辑  收藏  举报