保证运行成功,呵呵。如你想输入2个数,先输入2回车,然后输入一个要分解的数,回车,即可运行得出结果;同样的再次输入第2个数进行运行。
#include
int main( )
{
int ri, repeat;
int digit;
long in, temp, pow;
scanf("%d", &repeat);
for(ri=1; ri<=repeat; ri++){
scanf("%ld", &in);
/*-------------------*/
pow=1;
temp=in;
while(temp!=0)
{
temp=temp/10;
pow=pow*10;
}
pow=pow/10;
while(pow!=0)
{
digit=in/pow;
in=in%pow;
pow=pow/10;
printf("%d ",digit);
}
/*-----------------*/
printf("\n");
}
}
#include
int main( )
{
int ri, repeat;
int digit;
long in, temp, pow;
scanf("%d", &repeat);
for(ri=1; ri<=repeat; ri++){
scanf("%ld", &in);
=============================
while(in>0)
{ pow=in%10;
printf("%d",pow);
in=in/10;
}
==============================
printf("\n");
}
}
int array[100];
int len = 0;
while (in > 0){
array[len] = in/10;
in %= 10;
len++;
}
for (int l = len-1; l >= 0; l--){
printf("%d ", array[l]);
}
while(pow>0){
temp=in%10;
pow=in/10;
printf("%ld",temp);
}
估计题目出的有错吧