Limited access

Upgrade to access all content for this subject

Consider the following method.

public static int mystery(int x)
{
    if (x <= 0)
        return 0;
    if (x%2 == 0)
        return x + mystery(x-2);
    else
        return x + mystery(x-1);
}

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

A

25

B

26

C

27

D

28

E

29

Select an assignment template