%.2d
could add the extra padding zeros
printf("%d.%.2d", n / 100, n % 100);
For example, if n
is 560
, the output is: 5.60
EDIT : I didn't notice it's UINT16
at first, according to @Eric Postpischil's comment, it's better to use:
printf("%d.%.2d", (int) (x/100), (int) (x%100));