Question 1: (15 marks) Consider the following recursive method: public static int niceOne(int n){...

Question 1: (15 marks)

Consider the following recursive method:

public static int niceOne(int n){

     if(n<10)

     return n;

else

     return(n%10)+ niceOne(n/10);

}

  1. Trace the above recursive method for n=3524    (10 marks)

You should show all the recursive steps (composition and decomposition)

  1. Write the complete program that includes the above method and the necessary statements to print the returned value n. Include a screenshot that shows the code and the output. (5 marks)

Solved
COMPUTER SCIENCE 1 Answer Steve Jeff