answersLogoWhite

0

Say you have some integer a. a

First take it's absolute value. |a|

Next log it base 10. log10 |a|

Truncate this value, then add 1. trunc ( log10 |a| ) + 1

You now have the number of digits.

User Avatar

Wiki User

13y ago

Still curious? Ask our experts.

Chat with our AI personalities

ProfessorProfessor
I will give you the most educated answer.
Chat with Professor
RossRoss
Every question is just a happy little opportunity.
Chat with Ross
TaigaTaiga
Every great hero faces trials, and you—yes, YOU—are no exception!
Chat with Taiga

Add your answer:

Earn +20 pts
Q: To count the no of digits in an integer?
Write your answer...
Submit
Still have questions?
magnify glass
imp