While Loop Simulation

Category: Simulation
Author: Helene Martin and Marty Stepp
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 mystery(int x, int y) {
	int z = 1;
	while (x > 0) {
		System.out.print(y + ", ");
		y = y - z;
		z = z + y;
		x--;
	}
	System.out.println(y);
}

1) mystery(2, 3);
2) mystery(3, 5);
3) mystery(4, 7);