#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语言训练-8除不尽的数 (C语言代码)暴力解法,答案只有一个,直接输出就好了浏览:1045 |
C语言程序设计教程(第三版)课后习题7.3 (C语言代码)浏览:641 |
C二级辅导-公约公倍 (C语言代码)浏览:2158 |
C语言程序设计教程(第三版)课后习题11.1 (C语言代码)浏览:822 |
C语言训练-计算1977!* (C++代码)浏览:907 |
C语言程序设计教程(第三版)课后习题10.7 (C语言代码)浏览:998 |
C语言程序设计教程(第三版)课后习题6.10 (C语言代码)浏览:900 |
C语言程序设计教程(第三版)课后习题8.8 (C语言代码)浏览:895 |
1642题解浏览:784 |
数组与指针的问题浏览:760 |