#include<stdio.h> int main() { int m=1,i=0; long int n; int a[16]; printf("Input an integer: "); scanf("%ld",&n); if(n<0) { n=-n; printf("- "); } while(n/m!=0) { a[i]=(n/m)%10; m=m*10; i++; } i--; for(;i>=0;i--) printf("%d ",a[i]); printf(" "); return 0; }
示例截图