printf, sprintf print at least two decimal places
Posted
by philbrowndotcom
on Stack Overflow
See other posts from Stack Overflow
or by philbrowndotcom
Published on 2010-06-03T14:24:29Z
Indexed on
2010/06/03
14:34 UTC
Read the original article
Hit count: 244
I'm trying to figure out how to use sprintf to print at least two decimal places and no leading zeros. For instance
input:
23
23.0
23.5
23.55
23.555
23.0000
output:
23.00
23.00
23.50
23.55
23.555
23.00
any formatting help would be appreciated
© Stack Overflow or respective owner