I have an UINT16
unsigned integer of say
4455, 312, 560 or 70.
How to use printf to insert a decimal point before the last two
You can use printf directly with out using float
printf("%d.%02d", num/100, num%100);
%02d means right align with zero padding.
if num is 4455 ==>output is 44.55
if num is 203 ==>output is 2.03
EDIT:
by seeing comment from @ Eric Postpischil , it's better to use like this.
printf("%d.%02d", (int) (num/100), (int) (num%100));