1092: 輸出一個整數(shù)的各位數(shù)字
Time Limit:?1 SecMemory Limit:?128 MB
Submit:?3738Solved:?1181
Description
輸入一個正整數(shù) repeat (0
輸入一個整數(shù),從高位開始逐位輸出它的各位數(shù)字。
Input
輸入的整數(shù)可能大于1030
Output
見sample
Sample Input
3
123456
-600
8
Sample Output
1 2 3 4 5 6
6 0 0
8
#include <stdio.h>
#include <string.h>
int main()
{
char a[200000];
int rep,e;
scanf("%d",&rep);
while(rep--){
scanf("%s",&a);
e=0;
for(int i=0;i<strlen(a);i++){
if(a[i]>='0'&&a[i]<='9')
{
if(e!=0)
printf(" ");
printf("%c",a[i]);
e=1;
}
}
printf("\n");
}
return 0;
}