#include "stdio.h"
#include "stdlib.h"
int main() {
int a = 10;
float f;
double d;
char k = 'X';
scanf("%d", &a);
printf("%d\n", a);
scanf("%f", &f);
printf("%f\n", f);
scanf("%lf" , &d);
printf("%lf\n", d);
fflush(stdin);
scanf("%c",&k);
printf("%c\n",k);
return 0;
}
When I execute the code, I am only able to enter data until I enter a double value and then the program exits without asking for another input. Can someone please explain what is going on with this? I've been seeing online tutorials and the same code worked for them!
This is what I get, when I execute the program:
21
21
333.264765
333.264771
2317.23
2317.230000
Program ended with exit code: 0