Re: scanf to handle double




"Red Dragon" <tskhoon@xxxxxxxxxxxx> wrote in message
news:43697449_2@xxxxxxxxxxxxxxxxx
> Can someone please tell me how I should write scanf to handle double?
> This program works fine for float a but not double a, as the print
> result at end of program illustrates.
> Thanks
> Khoon
>
> #include <stdio.h>
>
> int main (void)
> {
> double a;
> a =2.1111;
>
> printf ("Enter a> ");
> scanf ("%f", &a);

scanf("%lf", &a);

-Mike


.



Relevant Pages