浮動小数点使いたくなければこんなかんじ
int keta(int num)
{
int n = 1;
while ((num /= 10) > 0)
++n;
return n;
}
ただし正の数のみ