逐步求余即可
注意事项:
参考代码:
#include <stdio.h>
int main ()
{
int a,b;
scanf("%d", &a);
if (a-10>=-10&&a-10<0)
{
printf("1\n");
printf("%d\n", a);
printf("%d", a);
}
else if (a-10>=0&&a-10<=89)
{
int q, w;
q = a%10;
w = (a - a%10)/10;
printf("2\n");
printf("%d %d\n", w,q);
printf("%d%d\n", q, w);
}
else if (a-10>=90&&a-10<=989)
{
int e, r, t;
e = (a-a%100)/100;
r = a%10;
t = (a%100-r)/10;
printf("3\n");
printf("%d %d %d\n", e, t, r);
printf("%d%d%d\n",r, t, e);
}
else if (a-10>=990&&a-10<=9989)
{
int f, g, h, j;
f = a%10;
g = (a%100-f)/10;
h = (a%1000-a%100)/100;
j = (a-a%1000)/1000;
printf("4\n");
printf("%d %d %d %d\n", j, h, g, f);
printf("%d%d%d%d\n", f, g, h, j);
}
else if (a-10>=9990&&a<=99989)
{
long z, x, c, v, b;
z = a%10;
x = (a%100-a%10)/10;
c = (a%1000-a%100)/100;
v = (a%10000-a%1000)/1000;
b = (a-a%1000)/10000;
printf("5\n");
printf("%ld %ld %ld %ld %ld\n", b, v, c, x, z);
printf("%ld%ld%ld%ld%ld", z, x, c, v, b);
}
return 0;
}
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:701 |
c primer plus 第十二章 12.1小节浏览:400 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:669 |
成绩转换 (C语言代码)浏览:1048 |
A+B for Input-Output Practice (III) (C语言代码)浏览:592 |
淘淘的名单 (C语言代码)浏览:1167 |
WU-蓝桥杯算法提高VIP-企业奖金发放 (C++代码)浏览:1267 |
母牛的故事 (C语言代码)浏览:594 |
C二级辅导-分段函数 (C语言代码)浏览:659 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:416 |