Question: Write a method called digitRange that accepts an integer as a parameter and returns the range of values of its digits. The range is defined
Write a method called digitRange that accepts an integer as a parameter and returns the range of values of its digits. The range is defined as 1 more than the difference between the largest and smallest digit value. For example, the call of digitRange(68437) would return 6 because the largest digit value is 8 and the smallest is 3, so 8 − 3 + 1 = 6. If the number contains only one digit, return 1. You should solve this problem without using a String.
Step by Step Solution
3.40 Rating (175 Votes )
There are 3 Steps involved in it
public static int digitRange int n n Ma... View full answer
Get step-by-step solutions from verified subject matter experts
