Limited access

Upgrade to access all content for this subject

Consider the following method.

public static int mystery(int x)
{
    if (x > 0)
        return x + mystery(x - 1);
    return 0;
}

Which of the following is returned when mystery(5) is called?

A

0

B

14

C

15

D

16

E

21

Select an assignment template