Question: In the following code, the variable indentAmt _ _ _ _ _ at each recursive call. public static int sum ( int n , String

In the following code, the variable indentAmt _____ at each recursive call.
public static int sum(int n, String indentAmt){
int sum =0;
if (n ==0){
System.out.println(indentAmt + "your value is: "+ n);
return 0;
}
else {
System.out.println(indentAmt + "your value is: "+ n);
sum = n + sum(n -1, indentAmt +"");
}
System.out.println(indentAmt + "Returning pos ="+ n);
return sum;
}
Group of answer choices
remains constant
is incremented
is incremented or decremented based on the call
is decremented

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!