解题思路:
注意事项:
参考代码:
#include<stdio.h>
int main()
{
int x,wei;
int ge,shi,bai,qian,wan;
scanf("%d",&x);
if(x<10&&x>=0)
{
wei = 1;
}else if(x<100&&x>=10)
{
wei = 2;
}else if(x<1000&&x>=100)
{
wei = 3;
}else if(x<10000&&x>=1000)
{
wei = 4;
}else
{
wei = 5;
}
switch(wei):
case 1:
printf("%d\n",wei);
printf("%d\n",x);
printf("%d\n",x);
break;
case 2:
printf("%d\n",wei);
ge = x%10;
shi = x/10;
printf("%d %d\n",shi,ge);
printf("%d%d\n",ge,shi);
break;
case 3:
ge = x%10;
shi = x/10%10;
bai = x/100;
printf("%d\n",wei);
printf("%d %d %d\n",bai,shi,ge);
printf("%d%d%d\n",ge,shi,bai);
break;
case 4:
ge = x%10;
shi = x/10%10;
bai = x/100%10;
qian = x/1000;
printf("%d\n",wei);
printf("%d %d %d %d\n",qian,bai,shi,ge);
printf("%d%d%d%d\n",ge,shi,bai,qian);
break;
default
ge = x%10;
shi = x/10%10;
bai = x/100%10;
qian = x/1000%10;
wan = x/10000;
printf("%d\n",wei);
printf("%d %d %d %d %d\n",wan,qian,bai,shi,ge);
printf("%d%d%d%d\n",ge,shi,bai,qian,wan);
break;
return 0;
}
0.0分
5 人评分
C语言程序设计教程(第三版)课后习题7.5 (C语言代码)浏览:589 |
点我有惊喜!你懂得!浏览:1392 |
C语言程序设计教程(第三版)课后习题6.1 (C语言代码)浏览:481 |
【数组的距离】 (C语言代码)浏览:787 |
大神老白 (C语言代码)浏览:690 |
C语言训练-阶乘和数* (C语言代码)-------- 呆板写法浏览:1396 |
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:1334 |
C语言程序设计教程(第三版)课后习题7.2 (C语言代码)浏览:570 |
1048题解(读入回车问题)浏览:628 |
C语言程序设计教程(第三版)课后习题11.8 (C语言代码)浏览:756 |