scanf not reading input correctly
I wrote a program:
Code:
int main(void) {
double iiput;
printf("\n\nEnter a degree value: ");
scanf("%14.10f", &iiput);
printf("%14.10f\n", iiput);}
and the user-machine interaction upon compiling this was:
Quote:
Enter a degree value: 200.5896113248
2.1702880859
Please explain what I am doing wrong?
Thank you.
Re: scanf not reading input correctly
Make sure that you have all warnings turned on when you compile your program, then the compiler will tell what might be wrong:
Quote:
$ gcc -Wall a.c
a.c: In function `main':
a.c:6: warning: unknown conversion type character `.' in format
a.c:6: warning: too many arguments for format
a.c:7: warning: control reaches end of non-void function
Try:
Code:
scanf("%lf", &iiput);