解题思路: 最原始的方法 肯定都看得懂
注意事项:
参考代码:#include<stdio.h>
int main(){
int a;
scanf("%d",&a);
if(1<=(a/10000)&&(a/10000)<10)
{
printf("5\n");
}
else if(1<=(a/1000)&&(a/1000)<10)
{
printf("4\n");
}
else if(1<=(a/100)&&(a/100)<10)
{
printf("3\n");
}
else if(1<=(a/10)&&(a/10)<10)
{
printf("2\n");
}
else
{
printf("1\n");
}
int b=a/10000;
int c=(a-(b*10000))/1000;
int d=(a-(b*10000)-(c*1000))/100;
int e=(a-(b*10000)-(c*1000)-(d*100))/10;
int f=(a-(b*10000)-(c*1000)-(d*100)-(e*10));
if(1<=(a/10000)&&(a/10000)<10)
{
printf("%d %d %d %d %d\n",b,c,d,e,f);
}
else if(1<=(a/1000)&&(a/1000)<10)
{
printf("%d %d %d %d\n",c,d,e,f);
}
else if(1<=(a/100)&&(a/100)<10)
{
printf("%d %d %d\n",d,e,f);
}
else if(1<=(a/10)&&(a/10)<10)
{
printf("%d %d\n",e,f);
}
else
{
printf("%d\n",f);
}
if(1<=(a/10000)&&(a/10000)<10)
{
printf("%d%d%d%d%d",f,e,d,c,b);
}
else if(1<=(a/1000)&&(a/1000)<10)
{
printf("%d%d%d%d",f,e,d,c);
}
else if(1<=(a/100)&&(a/100)<10)
{
printf("%d%d%d",f,e,d);
}
else if(1<=(a/10)&&(a/10)<10)
{
printf("%d%d",f,e);
}
else
{
printf("%d",f);
}
return 0;
}
0.0分
2 人评分
三进制小数 (C++代码)(第11位大于1.5才能进位)浏览:1203 |
C语言程序设计教程(第三版)课后习题10.3 (C语言代码)浏览:711 |
简单的a+b (C语言代码)浏览:689 |
C语言程序设计教程(第三版)课后习题4.9 (C语言代码)浏览:717 |
大神老白 (C语言代码)浏览:691 |
C语言程序设计教程(第三版)课后习题4.9 (C语言代码)浏览:1555 |
C语言程序设计教程(第三版)课后习题4.9 (C语言代码)浏览:592 |
C语言程序设计教程(第三版)课后习题9.3 (C语言代码)浏览:750 |
大家好,我是验题君浏览:604 |
1128题解(返回值为数组的情况)浏览:571 |