为什么输出的都是个位数?
#include <stdio.h>#include <math.h>
int main() {
int num, ge, shi, bai, qian, wan,wei;
printf("请输入一个不多于5位的整数:");
scanf("%d", &num);
if (num > 9999)
wei = 5;
else if ("num>999")
wei = 4;
else if ("num>99")
wei = 3;
else if ("num>9")
wei = 2;
else
wei = 1;
ge = num % 10;
shi= num %100/ 10;
bai = num %1000/ 100;
qian = num%10000 / 1000 ;
wan = num / 10000 ;
switch (wei) {
case'5':printf("5位数\n");
printf("正序:%d%d%d%d%d", wan, qian, bai, shi,ge);
printf("反序:%d%d%d%d%d", ge, shi, bai, qian, wan);
break;
case'4':printf("4位数\n");
printf("正序:%d%d%d%d", qian, bai, shi, ge);
printf("反序:%d%d%d%d", ge, shi, bai, qian );
break;
case'3':printf("3位数\n");
printf("正序:%d%d%d", bai, shi, ge);
printf("反序:%d%d%d", ge, shi, bai );
break;
case'2':printf("2位数\n");
printf("正序:%d%d",shi, ge);
printf("反序:%d%d", ge, shi );
break;
default:
printf("1位数\n");
printf("正序:%d", ge);
printf("反序:%d", ge);
break;
}
return 0;
}