1040 - Average 3
A Solution in c
#include<stdio.h>
int main()
{
double a, b, c, d, last, m;
scanf("%lf %lf %lf %lf", &a, &b, &c, &d);
m = (a*2 + b*3 + c*4 + d) / 10;
printf("Media: %.1lf\n", m);
if(m >= 7.0)
{
printf("Aluno aprovado.\n");
}
else if(m >= 5.0)
{
printf("Aluno em exame.\n");
scanf("%lf", &last);
printf("Nota do exame: %.1f\n", last);
if(last+m / 2.0 > 5.0)
{
printf("Aluno aprovado.\n");
}
else
{
printf("Aluno reprovado.\n");
}
printf("Media final: %.1lf\n", (last+m) / 2.0);
}
else
{
printf("Aluno reprovado.\n");
}
return 0;
}
int main()
{
double a, b, c, d, last, m;
scanf("%lf %lf %lf %lf", &a, &b, &c, &d);
m = (a*2 + b*3 + c*4 + d) / 10;
printf("Media: %.1lf\n", m);
if(m >= 7.0)
{
printf("Aluno aprovado.\n");
}
else if(m >= 5.0)
{
printf("Aluno em exame.\n");
scanf("%lf", &last);
printf("Nota do exame: %.1f\n", last);
if(last+m / 2.0 > 5.0)
{
printf("Aluno aprovado.\n");
}
else
{
printf("Aluno reprovado.\n");
}
printf("Media final: %.1lf\n", (last+m) / 2.0);
}
else
{
printf("Aluno reprovado.\n");
}
return 0;
}
No comments