#include <stdio.h> int main() { int a,b,c; scanf("%4d%2d%2d",&a,&b,&c); printf("year=%d\n",a); printf("month=%02d\n",b); printf("date=%02d",c); return 0; } printf("month=%02d\n",b); printf("date=%02d",c); 在输出时%0的用法 如果要输出的是两位数则使用%02 输出三位数则用%03 以此类推 意为左边的空位自动补0