0
I’m trying to learn C and today I made a very simple program that requests basic personal data and then it needs to print this data on the screen.
I put 5 items to be requested and he only requests half of them and the other half appears directly on the screen, without requesting anything. Like half is just one printf, You know? It doesn’t spin the part scanf.
I’ve already looked at all the code and I can’t find the error.
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
void main () {
setlocale(LC_ALL, "portuguese");
char nome;
float media;
int tel, id, mes;
printf("Digite a primeira letra do seu nome: ");
scanf("%c", &nome);
printf("Digite seu telefone: ");
scanf("%i", &tel);
printf("Digite sua média: ");
scanf("%2.2f", &media);
printf("Digite o mês do seu nascimento: ");
scanf("%i", &mes);
printf("Digite sua idade: ");
scanf("%i", &id);
}
"Pretend that here have the includes" it was not easier to put the includes?
– Woss
it was bad Anderson, I couldn’t make it
– Vitória Oliveira
Try to leave:
scanf("%f", &media);– sbrubes
sbrubes ready, I changed it and typed as whole. Thank you very much
– Vitória Oliveira