A. 6
Explanation:
>> func(x) runs recursively using return x + func(x-1). Assigning the argument 3 runs as follows: func(3) = 3 + func(2), func(2) = 2 + func(1), func(1) = 1 + func(0), func(0) = 0 (which triggers the if statement ending the recursive loop and returning 0). These values are equivalent to 3+2+1+0, so the output is 6
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Donny_575
3 weeks, 4 days ago