AcWing 661. 平均数3
原题链接
中等
作者:
Timi
,
2020-01-01 15:42:18
,
所有人可见
,
阅读 1122
#include <cstdio>
int main() {
double n1, n2, n3, n4, x, y, z;
scanf("%lf %lf %lf %lf", &n1, &n2, &n3, &n4);
x = (2 * n1 + 3 * n2 + 4 * n3 + n4) / (2 + 3 + 4 + 1);
printf("Media: %.1f\n", x);
if(x >= 7) puts("Aluno aprovado.");
else if(x < 5) puts("Aluno reprovado.");
else if(x >= 5 && x <= 6.9) {
puts("Aluno em exame.");
scanf("%lf", &y);
printf("Nota do exame: %.1f\n", y);
z = (x + y) / 2;
printf("%s\n", z > 5 ? "Aluno aprovado." : "Aluno reprovado.");
printf("Media final: %.1f", z);
}
return 0;
}