代码附上~~
求采纳!
1 #include
2
3 int main(){
4 printf("请输入不多于5位正整数:");
5 int n,i;
6 int count = 0,c[5] = {0};
7 scanf("%d",&n);
8 if(n>99999||n<0){
9 printf("输入错误,程序终止。\n");
10 return -1;
11 }
12 while(n){
13 c[count] = n%10;
14 count++;
15 n /= 10;
16 }
17 printf("这是%d位数\n",count);
18 for(i=count-1;i>=0;i--)
19 printf("%d ",c[i]);
20 printf("\n");
21 return 0;
22 }
#include
int main(int argc, char *argv[])
{ int n,i=0,k=1,m;
printf("输入一个整数:");
scanf("%d",&n);
m=n;
while (m!=0)
{
i++;
k=k*10;
m=m/10;
}
printf("\n%d是个%d位数,其各位数字分别是:",n,i);
m=n;
k=k/10;
while(m!=0)
{
printf("%d ",m/k);
m=m%k;
k=k/10;
}
printf("\n\n");
return 0;
}
#include
#include
int main(void)
{
long t = 0;
char x[10] = {0};
char length = 0;
printf("\nInput integer number(should be less than 100000):\n", t);
scanf("%ld", &t);
if (t < 0)
{
t = -t;
}
t %= 100000;
while (0 != t)
{
x[length] = t % 10;
++length;
t /= 10;
}
printf("\nThe length is: %d\n", length);
printf("\nThe number are:\n");
if (0 == length)
{
printf("%d\n", t);
}
else
{
do
{
printf("%d ", x[length - 1]);
} while (0 < --length);
}
return 0;
}