Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

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
Source by www.tutorialgateway.org #
 
PREVIOUS NEXT
Tagged: #digits #number
ADD COMMENT
Topic
Name
7+9 =