#include<stdio.h>
int a;
void num_bit(int);
void prireverse_order(int);
int main()
{
int num;
scanf("%d",&num);
num_bit(num);
prireverse_order(num);
return 0;
}
void num_bit(int num)
{
if(num>10000){
a=5;
printf("%d\n",a);
}
else if(num>1000){
a=4;
printf("%d\n",a);
}
else if(num>100){
a=3;
printf("%d\n",a);
}
else if(num>10){
a=2;
printf("%d\n",a);
}
else{
a=1;
printf("%d\n",a);
}
}
void prireverse_order(int num)
{
int ge,shi,bai,qian,wan;
switch(a){
case 1:printf("%d",num);break;
case 2:shi=num/10;
ge=num%10;
printf("%d %d\n",shi,ge);
printf("%d%d",ge,shi);
break;
case 3:bai=num/100;
shi=(num-bai*100)/10;
ge=num-100*bai-shi*10;
printf("%d %d %d\n",bai,shi,ge);
printf("%d%d%d",ge,shi,bai);
break;
case 4:qian=num/1000;
bai=(num-qian*1000)/100;
shi=(num-1000*qian-100*bai)/10;
ge=num-qian*1000-bai*100-shi*10;
printf("%d %d %d %d\n",qian,bai,shi,ge);
printf("%d%d%%d%d",ge,shi,bai,qian);
break;
case 5:wan=num/10000;
qian=(num-wan*10000)/1000;
bai=(num-wan*10000-qian*1000)/100;
shi=(num-wan*10000-qian*1000-bai*100)/10;
ge=(num-wan*10000-qian*1000-bai*100-shi*10);
printf("%d %d %d %d %d\n",wan,qian,bai,shi,ge);
printf("%d%d%d%d%d",ge,shi,bai,qian,wan);
break;
default:puts("You are wrong.");break;
}
}
0.0分
0 人评分
校门外的树 (C语言代码)浏览:1163 |
C语言程序设计教程(第三版)课后习题4.9 (C语言代码)浏览:715 |
C语言程序设计教程(第三版)课后习题1.5 (C++代码)浏览:777 |
计算质因子 (C++代码)浏览:1805 |
用筛法求之N内的素数。 (C语言代码)浏览:1373 |
C语言程序设计教程(第三版)课后习题4.9 (C语言代码)浏览:386 |
众数问题 (C语言代码)浏览:901 |
三角形 (C++代码)递归(存在大量重复计算,容易出现时间超限)浏览:834 |
数字游戏 (C++代码)浏览:1234 |
IP判断 (C语言代码)浏览:589 |