The printf() Flags
0 For numeric forms, pad the field width with leading zeros instead of with spaces. This
flag is ignored if a - flag is present or if, for an integer form, a precision is specified.
Examples: "%010d" and "%08.3f"
示例代码:
#include <stdio.h>
const int NB = 123;
int main(void)
{
printf("%04d",NB);
return 0;
}