Solved

Complete the Code for the Recursive Method PrintSum Shown in This

Question 2

Multiple Choice

Complete the code for the recursive method printSum shown in this code snippet, which is intended to return the sum of digits from 1 to n:
Public static int printSum(int n)
{
If (n == 0)
{
Return 0;
}
Else
{
______________________________
}
}


A) return (printSum(n - 1) ) ;
B) return (n + printSum(n + 1) ) ;
C) return (n + printSum(n - 1) ) ;
D) return (n - printSum(n - 1) ) ;

Correct Answer:

verifed

Verified

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents