Answers for "c how many digits has a number"

3

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
Posted by: Guest on July-27-2020

Code answers related to "c how many digits has a number"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language