#include <stdint.h> #include <stdio.h> int main() { int n=0; scanf("%d",&n); if (n<1000) printf("数字太小"); else if (n>=10000) printf("数字太大");//数字是否为四位数 else { int a=n/1000;//取千位 int tempt=n%1000; int b=tempt/100;//取百位 tempt=tempt%100; int c=tempt/10;//取十位 tempt=tempt%10;//取个位 printf("%d%d%d%d",tempt,c,b,a);//输出 } return 0; }//更推荐使用while循环