I wrote this program for getting a double input:
double n; scanf("%lf",&n); while(fgetc(stdin)!='\n') return 0; printf("%lf",n); This program is supposed to take double as input. Provided that %lf is the format specifier for double in scanf, I used it. But for inputs of a digit followed by e. ex.(3e), the input is being read without errors. But during processing of the same variable, it is discarding the e and only considering 3 as is shown by the printf statement. What is the cause of such behaviour?