Decimal Places in C

I know that to print the number 2.0000 to 2 decimal places I print% .2 f. But my question is:

input:
2
1000
20
200
output
0002
1000
0020
0200

how to increase the decimal places from right to left?
Have you tried %04d?
Last edited on
very interesting your MSDN link in *NIX forum ...
printf is from the standard library. What does it matter who describes it?
Because Microsoft has non-standard extensions to printf() family of functions, which is only available with Visual Studio compiler.
Last edited on
like?
http://msdn.microsoft.com/en-us/library/tcxf1dw6(v=vs.71).aspx "The optional prefixes to type, h, l, I, I32, and I64, (...) are Microsoft extensions and are not ANSI-compatible"
I guess support for __int32 and __int64 are a hint.

Point taken.
Topic archived. No new replies allowed.