Question: Write the code for sumDigitsInNumber(int number). The method takes a three-digit whole number . You need to calculate the sum of the digits of this
Write the code for sumDigitsInNumber(int number). The method takes a three-digit whole number. You need to calculate the sum of the digits of this number, and then return the result.
Consider this example: The sumDigitsInNumber method is called with the argument 321. Output 6. Please note that The sumDigitsInNumber method must return the sum of all digits in the parameter number.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
