Question
Beecrowd 1040 Average 3 Solution in C,C++,Python
#include <stdio.h>
int main()
{
float a, b, c, d, e, i, j, k;
double avg, avrg;
scanf("%f %f %f %f", &a, &b, &c, &d);
avg = ((a*2) + (b*3) + (c*4) + d) / 10;
printf("Media: %.1lf\n", avg);
if ( avg < 5.0 ){
printf("Aluno reprovado.\n");
}
else if( avg >= 7.0 ){
printf("Aluno aprovado.\n");
}
else{
printf("Aluno em exame.\n");//Beecrowd 1040 Average 3 Solution
scanf("%f",&e);
printf("Nota do exame: %.1f\n",e);
avrg = (avg+e) / 2;
if ( avrg >= 5.0 ){
printf("Aluno aprovado.\n");
}
else {printf ("Aluno reprovado.\n");
}
printf("Media final: %.1lf\n",avrg);
}
return 0;
}
Beecrowd 1040 Average 3 Solution in C++
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
float a, b, c, d, e;
double avg, avrg;
cin >> a >> b >> c >> d;
avg = ((a * 2) + (b * 3) + (c * 4) + d) / 10;
cout << fixed << setprecision(1);
cout << "Media: " << avg << endl;
if (avg < 5.0) {
cout << "Aluno reprovado." << endl;
} else if (avg >= 7.0) {
cout << "Aluno aprovado." << endl;
} else {
cout << "Aluno em exame." << endl;
cin >> e;
cout << "Nota do exame: " << e << endl;
avrg = (avg + e) / 2;
if (avrg >= 5.0) {
cout << "Aluno aprovado." << endl;
} else {
cout << "Aluno reprovado." << endl;
}
cout << "Media final: " << avrg << endl;
}
return 0;
}
Beecrowd 1040 Average 3 Solution in Python
a, b, c, d = map(float, input().split())
avg = ((a * 2) + (b * 3) + (c * 4) + d) / 10
print(f"Media: {avg:.1f}")
if avg < 5.0:
print("Aluno reprovado.")
elif avg >= 7.0:
print("Aluno aprovado.")
else:
print("Aluno em exame.")
e = float(input())
print(f"Nota do exame: {e:.1f}")
avrg = (avg + e) / 2
if avrg >= 5.0:
print("Aluno aprovado.")
else:
print("Aluno reprovado.")
print(f"Media final: {avrg:.1f}")
Hey people!!!!!
Good mood and good luck to everyone!!!!!
Hey people!!!!!
Good mood and good luck to everyone!!!!!
Hey people!!!!!
Good mood and good luck to everyone!!!!!