I am creating a program that reads the student's name, the number of absences, 3 grades and returns if the student has passed, failed for failure or failed by average, knowing that the limit of absences is 15, the minimum grade for approval is 7 and that failure for failure overrides disapproval by average.
But it happens that after printing on the screen "enter the number of faults", the program does not expect me to enter a number, but soon ends the program. What is wrong?
#include <stdio.h>
int main() {
char nome;
int f;
float n1,n2,n3;
float mf=(n1+n2+n3)/3;
printf("Digite o nome do aluno: \n");
scanf("%c", &nome);
printf("Digite o numero de faltas do aluno: \n");
scanf("%d", &f);
if (f > 15)
printf("Aluno reprovado por falta. \n");
else {
printf("Digite a primeira nota do aluno: \n");
scanf("%f", &n1);
printf("Digite a segunda nota do aluno: \n");
scanf("%f", &n2);
printf("Digite a terceira nota do aluno: \n");
scanf("%f", &n3);
if(mf>=7)
printf("Aluno aprovado! \n");
else
printf("Aluno reprovado por media. \n");
}
return 0;
}