URI Online Judge | 1040
Média 3
Adaptado por Neilor Tonin, URI
Brasil
Timelimit: 1
BrasilLeia quatro números (N1, N2, N3, N4), cada um deles com uma casa decimal, correspondente às quatro notas de um aluno. Calcule a média com pesos 2, 3, 4 e 1, respectivamente, para cada uma destas notas e mostre esta média acompanhada pela mensagem "Media: ". Se esta média for maior ou igual a 7.0, imprima a mensagem "Aluno aprovado.". Se a média calculada for inferior a 5.0, imprima a mensagem "Aluno reprovado.". Se a média calculada for um valor entre 5.0 e 6.9, inclusive estas, o programa deve imprimir a mensagem "Aluno em exame.".
No caso do aluno estar em exame, leia um valor correspondente à nota do exame obtida pelo aluno. Imprima então a mensagem "Nota do exame: " acompanhada pela nota digitada. Recalcule a média (some a pontuação do exame com a média anteriormente calculada e divida por 2). e imprima a mensagem "Aluno aprovado." (caso a média final seja 5.0 ou mais ) ou "Aluno reprovado.", (caso a média tenha ficado 4.9 ou menos). Para estes dois casos (aprovado ou reprovado após ter pego exame) apresente na última linha uma mensagem "Media final: " seguido da média final para esse aluno.
Entrada
A entrada contém quatro números de ponto flutuante correspendentes as notas dos alunos.
Saída
Todas as respostas devem ser apresentadas com uma casa decimal. As mensagens devem ser impressas conforme a descrição do problema. Não esqueça de imprimir o enter após o final de cada linha, caso contrário obterá "Presentation Error".
URI Online Judge | 1040
Average 3
Adapted by Neilor Tonin, URI
Brazil
Timelimit: 1
BrazilRead four numbers (N1, N2, N3, N4), which one with 1 digit after the decimal point, corresponding to 4 scores obtained by a student. Calculate the average with weights 2, 3, 4 e 1 respectively, for these 4 scores and print the message "Media: " (Average), followed by the calculated result. If the average was 7.0 or more, print the message "Aluno aprovado." (Approved Student). If the average was less than 5.0, print the message: "Aluno reprovado."(Reproved Student). If the average was between 5.0 and 6.9, including these, the program must print the message "Aluno em exame." (In exam student).
In case of exam, read one more score. Print the message "Nota do exame: " (Exam score) followed by the typed score. Recalculate the average (sum the exam score with the previous calculated average and divide by 2) and print the message “Aluno aprovado.” (Approved student) in case of average 5.0 or more) or "Aluno reprovado."(Reproved student) in case of average 4.9 or less. For these 2 cases (approved or reproved after the exam) print the message "Media final: " (Final average) followed by the final average for this student in the last line.
Input
The input contains four floating point numbers that represent the students' grades.
Output
Print all the answers with one digit after the decimal point.
#include <stdio.h>
int main() {
double N1, N2, N3, N4, EF, M;
scanf("%lf %lf %lf %lf", &N1, &N2, &N3, &N4);
M = (N1*2+N2*3+N3*4+N4)/10;
printf("Media: %.1f\n", M);
if (M >= 7.0){
printf("Aluno aprovado.\n");
}
else if (M >= 5.0)
{
printf("Aluno em exame.\n");
scanf("%lf", &EF);
printf("Nota do exame: %.1f\n", EF);
if (EF + M / 2.0 > 5.0){
printf("Aluno aprovado.\n");
}
else{
printf("Aluno reprovado.\n");
}
printf("Media final: %.1f\n", (EF + M ) / 2.0);
}
else{
printf("Aluno reprovado.\n");
}
return 0;
}
Nenhum comentário:
Postar um comentário