Question: In JAVA, Write a method called calcDigitInfo that takes as argument an int and returns an array containing two values: the number of digits in
In JAVA,
Write a method called calcDigitInfo that takes as argument an int and returns an array containing two values: the number of digits in the input integer and the sum of the digits in the input integer.
For example, calcDigitInfo(12345) would return an array containing {5, 15} because there are 5 digits and 1 + 2 + 3 + 4 + 5 = 15.
The input integer can be positive, negative, or 0. calcDigitInfo(0) would return an array containing {1, 0} because 0 is a digit.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
