Problem Description
从键盘输入一个长整数(不超过10位),从高位开始逐位分割并输出。
Input
正整数n,不含前导零。
Output
分割的整数序列,各整数之间用空格格开。
注意,最后一个数字后面没有空格!
Example Input
654321
Example Output
6 5 4 3 2 1
#include<stdio.h> int main() { long n; int a[10],i,j; scanf("%ld",&n); for(i=0;i<10;i++) { a[i]=n; n/=10; if(n==0) break; } for(j=i;j>=0;j--) { if(j==0) printf("%d\n",a[j]); else printf("%d ",a[j]); } return 0; }
转载请注明原文地址: https://ju.6miu.com/read-971895.html