|
-
January 8th, 2008, 10:31 AM
#8
Re: Calculating number of digits?
or a 'brute force' method - use integer division, and divide by multiples of 10 until the result is zero - would be a simple loop to write:
(int)(93938/ (1*10)) = 9394
(int)(93938/ (2*10)) = 940
(int)(93938/ (3*10)) = 94
(int)(93938/ (4*10)) = 9
(int)(93938/ (5*10)) = 0 // answer is 5
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|