How can I display a double like
5000683
Instead of 5.000683e6
in C?
I have tried %d
, %g
and %f
, but to no avail.
How can I display a double like
5000683
Instead of 5.000683e6
in C?
I have tried %d
, %g
and %f
, but to no avail.
It looks like
%f
works just fine:The output of this code will be
The second
printf()
statement sets the precision to 0 (by prefixingf
with.0
) to avoid any digits after the decimal point.