#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语言程序设计教程(第三版)课后习题6.3 (C语言代码)浏览:543 |
C语言训练-计算1~N之间所有奇数之和 (C语言代码)浏览:691 |
C语言程序设计教程(第三版)课后习题6.4 (C语言代码)浏览:1073 |
【简单计算】 (C语言代码)浏览:642 |
【计算两点间的距离】 (C语言代码)浏览:1522 |
勾股数 (C语言代码)浏览:832 |
C语言程序设计教程(第三版)课后习题6.8 (C语言代码)浏览:655 |
C语言训练-排序问题<1> (C语言代码)浏览:369 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:469 |
母牛的故事 (C语言代码)浏览:548 |