请问什么地方出错了?
给一个不多于5位的正整数,要求:1.求出它是几位数;
2.安逆序输出。
#include <stdio.h>
void main()
{
int z;
long int a,gw,sw,bw,qw,ww;
printf("输入99999以内的数");
scanf("%ld",&a);
if(a>9999){z=5;ww=a/10000;}
else if(a>999){z=4;qw=a/1000;}
else if(a>99){z=3;bw=a/100;}
else if(a>9){z=2;sw=a/10;}
else z=1;gw=a/1;
printf("是%d位数\n",z);
printf("逆序是");
if(z==5)
printf("%ld%ld%ld%ld%ld\n",gw,sw,bw,qw,ww);
else if(z==4)
printf("%ld%ld%ld%ld\n",gw,sw,bw,qw);
else if(z==3)
printf("%ld%ld%ld\n",gw,sw,bw);
else if(z==2)
printf("%ld%ld\n",gw,sw);
else printf("%ld\n",gw);
}