AcWing 661. 平均数3
原题链接
中等
作者:
lhj
,
2021-03-24 09:24:42
,
所有人可见
,
阅读 227
C++ 代码
#include<cstdio>
#include<cmath>
int main(){
double N1,N2,N3,N4,X,Y,Z;
scanf("%lf%lf%lf%lf",&N1,&N2,&N3,&N4);
X = (N1*2+N2*3+N3*4+N4)/10;
printf("Media: %.1f\n",round(X*10)/10);
if(X>=7.0) printf("Aluno aprovado.\n");
else if(X<5.0) printf("Aluno reprovado.\n");
else {
//if(X>=5.0&&X<7.0)
printf("Aluno em exame.\n");
scanf("%lf",&Y);
printf("Nota do exame: %.1f\n",Y);
Z = (X+Y)/2;
if(Z>=5.0) printf("Aluno aprovado.\n");
else printf("Aluno reprovado.\n");
printf("Media final: %.1f\n",Z);
}
return 0;
}