Formatting of integers and floating point values can be done using
Formatting Numbers Demo
1000.00 100000 1.00000e+07 1.00000e+09
Formatting the floating point types and print them in shortest form can be done using '%g' as shown above. Initially it uses '%f' for formatting, but as the size increases, it switches to '%e' for printing.
THINGS TO TRY