数字拆分 已知一个正整数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
谢谢 给出程序.最好是递归的
其他人气: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]);}
我来回答
类似推荐
请使用1024x768 IE6.0或更高版本浏览器浏览本站点,以保证最佳阅读效果。本页提供作业小助手,一起搜作业以及作业好帮手最新版!
版权所有 CopyRight © 2012-2024 作业小助手 All Rights Reserved. 手机版