早教吧作业答案频道 -->其他-->
帮忙看个程序:需要输入一个班全体学生的成绩,把不及格的学生成绩输出,并求及格学生的平均成绩.#includevoidmain(){intn;doublescore,sum=0,average;for(n=0;n=60){sum=sum+score;n++;}elseif(score=0)printf("%3d\n"
题目详情
帮忙看个程序:需要输入一个班全体学生的成绩,把不及格的学生成绩输出,并求及格学生的平均成绩.
#include
void main()
{
int n;
double score,sum=0,average;
for(n=0;n=60)
{ sum=sum+score;n++;}
else if(score=0) printf("%3d\n",score);
else if(score
#include
void main()
{
int n;
double score,sum=0,average;
for(n=0;n=60)
{ sum=sum+score;n++;}
else if(score=0) printf("%3d\n",score);
else if(score
▼优质解答
答案和解析
你定义的是double的变量,使用的时候全部是%d
对应的变量使用的地方换成%lf
double是双精度浮点数,要用%lf来输入输出
int %d
float %f
double %lf
#include
void main(){
int n;
double score,sum=0,average;
for(n=0;n=60) {
sum=sum+score;
n++;
} else if(score=0)
printf("%3lf\n",score);
else if(score
对应的变量使用的地方换成%lf
double是双精度浮点数,要用%lf来输入输出
int %d
float %f
double %lf
#include
void main(){
int n;
double score,sum=0,average;
for(n=0;n=60) {
sum=sum+score;
n++;
} else if(score=0)
printf("%3lf\n",score);
else if(score
看了 帮忙看个程序:需要输入一个班...的网友还看了以下:
猴子吃桃问题.猴子第一天摘下若干个桃子,当即吃了一半,还不过瘾,又多吃了一个,以下是我的程序,#in 2020-03-30 …
expected';'before‘)’token是什么意思第11行和14行出现这句话#includ 2020-03-31 …
Indexexceedsmatrixdimensions.>>disp('');disp(''); 2020-04-26 …
X服从正态分布;X1,X2.Xn是它的一个样本数学期望E(SUM|Xi-X|)=nE|X1-X|么 2020-06-10 …
C语言斐波那契数列求和问题#include<stdio.h>intf(intn);voidmain 2020-07-23 …
功能:输出Fibonacci数列前20项中,下标为偶数的元素之和.已知前两项的值分别为1,1.从第 2020-07-23 …
#include"stdio.h"#include"math.h"#include"stdlib. 2020-07-23 …
关于fortran6.PROGRAMMAIN2N=3Y=(SUM(N)+SUM(N+1)+SUM( 2020-07-23 …
[freepascal]矩阵问题描述输入一个矩阵的行数,输出对应的图形(对角线数据为0,其余为1)。 2020-11-18 …
求高手解答,为什么我原样抄下来的程序,就是不行,会默认一个数900多+第一个输入进去的数。。。菜鸟表 2020-12-10 …