0
I am studying C/C++ in college and came across the following problem, when I run the following code:
#include <stdio.h>
void main(){
char name[10];
int faltas;
double media;
printf("Digite seu nome, quantidade de faltas e sua media: \n");
scanf("%s" "%d" "%.2f", &name, &faltas, &media);
printf("Ola %s, voce tem %d faltas e sua media e %.2f",name,faltas,media);
}
Only the result does not show the mean value, as shown in the image below:
I wonder what I might be doing wrong, because in the exercise given by the teacher the resolution is the same as the code I put above.
Thanks in advance!!!
The scanf does not know (and has no simple way to solve) that you are using "," to separate decimals on average - use the decimal point "." and should work.
– jsbueno