Lowest price ever! Learn Generative AI for 48% less!
Get my discount+ 5
2 indicates that the length of year's value must be formatted with at least 2 place wide. If the year's value exceeds that, then 2 is ignored.
●●Example●●
If year = 2018;
Then the formatted output would be as
2018
By default, the formatted output is right-aligned which means that if the output length is less than 2, then the output fills up with space before the actual number.
●●Example●●
year = 8;
The output would be as
◼8
In case of floating point numbers, the general form is
%width.precision f
Same as before, width defines the whole length of the number including its decimal point but the precision part forces the fraction length to be exactly as it says.