eth10


私信TA

用户名:etxx

访问量:2735

签 名:

等  级
排  名 31959
经  验 436
参赛次数 0
文章发表 5
年  龄 0
在职情况 学生
学  校 贵州大学
专  业

  自我简介:

解题思路:

逆序及位数以10为基准值即可直接获取





注意事项:

如果没要求输出的位置,那么代码还可以进行简化



参考代码:

#include<stdio.h>

void nixu(int a);


int main()

{

int i=1,a,c,d,num;

int tmp=1;

scanf("%d",&a);

c=a;

d=c;

while(c/10!=0)

{

     c=c/10;

     i++;

     tmp=tmp*10;

}

printf("%d\n",i);

while(tmp/10!=1)

{

    printf("%d ",d/tmp);

    d=d%tmp;

    tmp=tmp/10;

}

printf("%d %d\n",d/tmp,d%tmp);

nixu(a);

return 0;

}

void nixu(int a)

{

int b;

while(a/10!=0)

{

     b=a%10;

     a=a/10;

     printf("%d",b);

}

printf("%d\n",a);

}


 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区