Question: Code in java - Write method called SumDigits which takes an integer as a parameter, sums the digits of the number and retums the sum.

Code in java Code in java - Write method called SumDigits which takes an integer

- Write method called SumDigits which takes an integer as a parameter, sums the digits of the number and retums the sum. - The method signature is: public static int SumDigits(int n ) - You will need to use % to determine the specific digit and/to remove the digit from right to left. - Example output: 234 - 4+3+2=9 - The Math behind this: 234%10=4234/10=2323%10=323/10=223%10=22/10=0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!