check amount of digits of integer in c code example
Example: c how many digits has a number
digits = (number == 0) ? 1 : (log10(number) + 1);
//or
while (number > 0)
{
number /= 10;
digits++;
}
//see: https://ideone.com/P1h8Ne
digits = (number == 0) ? 1 : (log10(number) + 1);
//or
while (number > 0)
{
number /= 10;
digits++;
}
//see: https://ideone.com/P1h8Ne