I have a problem with my programs and sometimes I try programs with which I have to use more than one entry data, however when writing them, only the first entry data is read, skipping the others, and if I modify the program removing the only data that if read then if I can read the others, as an example I have this program:
#include <stdio.h>
int main ()
{
char n = 0;
int a = 0, a1 = 0, e = 0;
system("cmd /c cls");
printf("Hola \t");
scanf(" %c", n);
printf("%c\n", n);
printf("NACIO DEL AÑO \t");
scanf("%d", &a);
printf("año actual :\t");
scanf("%d", &a1);
printf("\n\n");
printf("En el año 2030 cumpliras \t");
e = 2030 - a;
printf("%d\t", e);
}
As you can see, first ask to type my name, but in doing so it does not allow entering the other input data, it jumps, but if I delete everything related then if I can enter the other input data. What can you owe? I've also tried it with examples already solved and I'm not allowed either:
#include <stdio.h>
#include <stdlib.h>
int main ()
{
double c, intereses, capital;
float r;
int t;
system ("cmd /c cls"); //Limpiar pantalla
/*Entrada de datos*/
printf("Capital invertido ");
scanf("lf", &c);
printf("\nA un porcentaje anual del ");
scanf("%f", &r);
printf("\nDurante cuántos días ");
scanf("%d", &t);
printf("\n\n");
/*Cálculos*/
intereses = c * r * t / (360L * 100);
capital = c + intereses;
/*Escribir resultados*/
printf("Intereses producidos...%10.0f\n", intereses);
printf("Capital acumulado......%10.0f\n", capital);
}
in this it only allows me to enter the three input data, the first and the third, but not the second, and I can only enter it when I delete the other input data from the program. PS I use netbeans