#include<stdio.h>
void main()
{
int i,j,k;
int a[5];
printf("please enter the number i:");
scanf("%d",&i);
if(i/100000!=0)
printf("error!");
else
if(i/10000!=0)
j=5;
else if(i/1000!=0)
j=4;
else if(i/100!=0)
j=3;
else if(i/10!=0)
j=2;
else
j=1;
printf("the number is %d wei",j);
printf("\n\n");
a[4]=i/10000;
a[3]=i%10000/1000;
a[2]=i%1000/100;
a[1]=i%100/10;
a[0]=i%10;
for(k=0;k<5;k++)
{
if(a[k])
printf("%1d",a[k]);
}
printf("\n");
}
这样就是了 应该可以
void main()
{
int i,j,k;
int a[5];
printf("please enter the number i:");
scanf("%d",&i);
if(i/100000!=0)
printf("error!");
else
if(i/10000!=0)
j=5;
else if(i/1000!=0)
j=4;
else if(i/100!=0)
j=3;
else if(i/10!=0)
j=2;
else
j=1;
printf("the number is %d wei",j);
printf("\n\n");
a[4]=i/10000;
a[3]=i%10000/1000;
a[2]=i%1000/100;
a[1]=i%100/10;
a[0]=i%10;
for(k=0;k<5;k++)
{
if(a[k])
printf("%1d",a[k]);
}
printf("\n");
}
这样就是了 应该可以
做最好的自己