#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语言程序设计教程(第三版)课后习题11.1 (C语言代码)浏览:774 |
C二级辅导-分段函数 (C语言代码)浏览:558 |
Biggest Number (错误代码时间超限制)浏览:2260 |
C语言程序设计教程(第三版)课后习题8.7 (C语言代码)浏览:986 |
DNA (C++代码)浏览:671 |
C语言训练-求矩阵的两对角线上的元素之和 (C语言代码)浏览:760 |
【回文数(二)】 (C语言代码)浏览:800 |
简单的a+b (C语言代码)浏览:877 |
字符逆序 (C语言代码)浏览:645 |
C语言程序设计教程(第三版)课后习题5.5 (C语言代码)浏览:590 |