I am supposed to rewrite the code below to "compute the number of digits to any base(such as base 2, base 16, base 8)." Just wondering if any of you can provide any explanation or pseudocode on how to go about doing this?
Thanks for any help you can give :).
int numdigits(int x)
{
int t = x, n = 1;
while(t>= 10)
{
n++;
t = t/10;
}
return n;
}