数字拆分 已知一个正整数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
谢谢 给出程序.最好是递归的
sample
please input an integer 101012340
After the splitting ,you can get: 1 0 1 0 1 2 3 4 5
谢谢 给出程序.最好是递归的
其他人气:705 ℃时间:2020-07-12 01:33:47
优质解答
#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]);}
我来回答
类似推荐