While Loop Simulation

Category: Simulation
Author: Marty Stepp and Helene Martin
Book Chapter: 5.1
Problem: While Loop Simulation
	For each call below to the following method, write the output that is produced, as it would appear on the console: 

public static void whileMystery(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);
}

1) whileMystery(-2, -6);
2) whileMystery(2, 3);
3) whileMystery(4, 8);
4) whileMystery(5, 40);
5) whileMystery(10, 31);