Question: 1. We can determine how many digits a positive integer has by repeatedly dividing by 10 (without keeping the remainder) until the number is less
1. We can determine how many digits a positive integer has by repeatedly dividing by 10 (without keeping the remainder) until the number is less than 10, consisting of only 1 digit. We add 1 to this value for each time we divided by 10. a) Describe the algorithm in a recursive way b) Implement this recursive algorithm in C++ and test it using a main function that calls this with the values of 15, 105 and 15105. (Hint: Remember if n is an integer, n/10 will be an integer without the fractional part.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
