Question: [4] 8 points (2 points for each part) use file Mystery.txt For each call below to the mystery method, write the output that is produced,

[4] 8 points (2 points for each part) use file Mystery.txt

For each call below to the mystery method, write the output that is produced, as it would appear on the console:

public static void mystery (int x, int y)

{

int s = 0;

while (x > 0 && 2 * y >= x)

{

System.out.print(s + " ");

y = y - x;

x--;

s = s + x;

}

System.out.println (s);

}

A. mystery (-2, -6);

B. mystery (2, 3);

C. mystery (4, 8);

D. mystery (10, 31);

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!