Question: please explain how i get that and while explaining please show example. i am really confuse about the % and divide part where how many

please explain how i get that and while explaining please show example. i am really confuse about the % and divide part where how many times do i need to divide or how many times do i need to % until i stop ? and what is the code do
Given a non-negative int n, return the sum of its digits recursively (no loops). Note that mod (%) by 10 yields the rightmost digit (126 % 10 is 6), while divide (/) by 10 removes the rightmost digit (126 / 10 is 12). sumDigits(126) 9 sumDigits (49) 13 sumDigits(12) 3 Run 9 Expected sum Digits(126) 9 sumDigits(49) Go OK ...Save, Compile, Run (ctrl-enter) + 13 13 OK sum Digits(12) 3 3 OK public int sumDigits(int n) { if (n Recursion-1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
