Question: Please help solve this using JAVA! Show me the OUTPUT also. Thank you in advance! a/Local/Packages/Microsoft.MicrosoftEdge 8wekyb3d8bbwe/TempState/Downloadsu 1.1 Count Digits We'll start out with something
a/Local/Packages/Microsoft.MicrosoftEdge 8wekyb3d8bbwe/TempState/Downloadsu 1.1 Count Digits We'll start out with something we've done in class before. Write a function countDigits which takes in an int num, which will return the number of digits in num. For example countDigits should evaluate to: . 1 for numbers 0-9, 2 for numbers 10-99, 3 for numbers 100-999, etc Remember, use repeated division by 10 to calculate the number of digits in num. (There's also a tricky solution using logarithms that avoids the repeated division!) 1.2 nth Digit Back Write a method nthDigitBack hich takes in two ints, n and num. This method finds the nth lowest ordeuldigit in num. In other words, nthDigitBack returns the nth digit from the right. The rightmost digit is considered the oth digit back. nthDigitBack should evaluate to 0 for digits out of range (so if you ask for the 1000th digit back of 7546, nthDigitBack will return 0). Here are some example method calls of nthDigitBack nthDigitBack (0, 123) 3 nthDigitBack (1,123) 2 nthDigitBack (2,123) 1 e nthDigitBack (3,123) 0 8 nthDigitBack (3,18023)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
