Warning: fopen(/www/wwwroot/www.wendadaohang.com/data/md5_content_title/0d/0d188ef5cf8d7efff7c6e79ea2f026b3.txt): failed to open stream: No space left on device in /www/wwwroot/www.wendadaohang.com/inc/function.php on line 2468

Warning: flock() expects parameter 1 to be resource, bool given in /www/wwwroot/www.wendadaohang.com/inc/function.php on line 2469

Warning: fclose() expects parameter 1 to be resource, bool given in /www/wwwroot/www.wendadaohang.com/inc/function.php on line 2475
输入20个成绩,求出全班平均成绩。并统计考试成绩90分及以上的学生人数和60分以下的学生人数。C语言编程 - 66问答网

输入20个成绩,求出全班平均成绩。并统计考试成绩90分及以上的学生人数和60分以下的学生人数。C语言编程

C语言编程 急需 大神求答案

#include<stdio.h>
#include<stdlib.h>

int main()
{
    double sum = 0.0;
    int count = 0;
    double temp;
    printf("please input the score. If you end the input just give the 1000 as the last score.\n");
    scanf("%lf",&temp);
    while(temp != 1000)
    {
        sum += temp;
        count++;
        scanf("%lf",&temp);
    }
    printf("The %d peoples average score is: %3.2lf\n", count, sum / count);
    
    
    
}

追问

亲……

谢谢你……

温馨提示:答案为网友推荐,仅供参考
第1个回答  2014-05-14
#include <stdio.h>
int main(void){
    int person=20, c1=c2=0;//人数和统计信息
    float total=0, score;
    //循环录入成绩信息
    for(i=0, i<person; ++i){
        scanf("%f",&score);
        if(score<60){
            ++c1;
        }else if(score>90){
            ++c2;
        }
        total += score;
    }
    printf("平均成绩%.2f,90分以上%d人,60以下%d人\n",(total/person),c2,c1);
    return 0;
}

第2个回答  2014-05-14
include <iostream>
int main()
{
int grade[20];
int count=0;//记录90分以上人数
int count2=0;//记录60以下人数
for(i=0;i<20;i++){
cin>>grade[i];

if(grade[i]>90)

count++;

elseif(grade[i<60])

count2++;

}
count<<"90分以上人数:"<<count<<endl;
count<<"60分以下人数:"<<count2<<endl;
}追问

亲……抱歉啊……我输了一遍……显示好多错误啊

谢谢你啊……

相似回答