[求助]输入一个正整数,求位数
输入1到5位的正整数求位数,不管输入什么都是"input wrong",看不出来毛病main()
{
int bit;
long num;
scanf("num=%ld",&num);
if(num<1||num>99999)
printf("\ninput wrong");
else
{ if(num>9999) bit=5;
else if(num>999) bit=4;
else if(num>99) bit=3;
else if(num>9) bit=2;
else bit=1;
printf("\nbit=%d",bit);
}
}