Take a look at the instructions below you:
Description of modifier format
INT A = 1;
INT B = 1234;
Double C = 1.2345678;
Printf ("% 2D \ n", a);
Printf ("% 2D \ n", a);
Printf ("% 4D \ n", a);
Printf ("% 2D \ n", b);
Printf ("% 2D \ n", b);
Printf ("% 4d \ n", b);
Printf ("% 2.2F \ n", c);
M% MD outputs an integer number with a width m, when ilcites M, left-specific space
0M% 0MD outputs an integer number in width m, when illegally M, left to make up
m, n% M.NF outputs a real decimal decimal in the width M, and the decimal bit is n bit.
Double I = 12.3,
Printf ("% 2f", i, a);
Output: 12.300000
Printf ("% 2.1f", i, a);
Output: 12.3
When the specified field width is less than the actual width of the data, the integer is output to the actual field width of the number, the corresponding number of floating points, the number of corresponding small digits is entered.
INT i = 1;
Printf ("% 04d", i);
Output: 0001
% 04D, output 4 digits (decimal), not enough to supplement 0