You are on page 1of 1

Time instance: 2:50

In the videos about Format specifier it has been told that %6.2f means at least
6 integral places and then after that 2 decimal places. But actually it is at
least 6 places including the digits after the decimal.

total width = 6
after decimal point = 2
for deimal point = 1
before decimal point = 6-1-2 = 3
so, _ _ _ . _ _
1 2 3 4 5 6 -> toal 6 places (3(remaining)+1(for decimal
point)+2(after decimal point))

“%6.2f” 100.1555 results are showing <NO space>100.16


“%8.2f” 100.1555 results are showing <space><space>100.16

%6.2f - Means minimum of total 6 characters including dot(.) and after decimal
only 2 places can be occupied.

You might also like