How show 00156,00
float number = 156;
printf("%5.2f",number);
The output of the example above:
Output: 156.00
How show 00156,00
float number = 156;
printf("%5.2f",number);
The output of the example above:
Output: 156.00
You need to pass the 0
flag for leading zeros, and the field width must be wide enough to have any leading characters printed. So you might try this:
printf("%08.2f", number);
The .
verses ,
(aka, the "radix character") is determined from the LC_NUMERIC portion of the locale. See man setlocale
for information on setting this programatically.