2
My first post here and I would like to know, because when I compile my code it gives an error saying the format %f
expecting a double
, whereas the f
is used to float
and the variable I’m putting is float
.
Follows the code:
#include <stdio.h>
float proceNotas(float nota1, float nota2, float nota3, char letter);
int main(){
float n1, n2, n3;
char letra;
printf("Digite a primeira nota: ");
scanf("%f", &n1);
printf("Digite a segunda nota: ");
scanf("%f", &n2);
printf("Digite a terceira nota: ");
scanf("%f", &n3);
getchar();
printf("Digite a operacao desejada: A) media aritmetica\nP) Media ponderada\nH) Media harmonica\n");
letra = getchar();
printf("\nA media do aluno é: %f"), proceNotas(n1, n2, n3, letra);
return 0;
}
float proceNotas(float nota1, float nota2, float nota3, char letter){
float arit, pond, harm;
switch(letter){
case 'A':
arit = nota1+nota2+nota3/3;
return arit;
break;
case 'P':
pond = (nota1*5)+(nota2*3)+(nota3*2)/5+3+2;
return pond;
break;
case 'H':
harm = 3/(1/nota1)+(1/nota2)+(1/nota3);
return harm;
break;
default:
return printf("Operacao invalida!");
}
}
I feel even ashamed, thank you very much, looking like this, are several silly mistakes
– Axel Felix
@Axelfelix, accept the reply of anonymity :). He replied but you did not mark his reply as useful and did not accept the reply
– Dherik
can you answer my question? https://answall.com/questions/469237/identificar-registrations-sequentialof each user
– JavaScript