当前位置: > 数字拆分 已知一个正整数n n 的范围为1-999999999.把n分成单个数字 然后打印,每个数字间用空格分开 如:12345 得到1 2 3 4 5...
题目
数字拆分 已知一个正整数n n 的范围为1-999999999.把n分成单个数字 然后打印,每个数字间用空格分开 如:12345 得到1 2 3 4 5
sample
please input an integer 101012340
After the splitting ,you can get: 1 0 1 0 1 2 3 4 5
谢谢 给出程序.最好是递归的

提问时间:2021-04-13

答案
#include int i=0;int Get(long c,int a[]){if(c==0)return(-1);a[i]=c%10;i++;c=c/10;Get(c,a);}void main(){long int a;int b[10];scanf("%d",&a);Get(a,b);i--;for(;i>=0;i--)printf("%d ",b[i]);}
举一反三
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
1,人们染上烟瘾,最终因吸烟使自己丧命.
版权所有 CopyRight © 2012-2019 超级试练试题库 All Rights Reserved.