While Loop Simulation

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

public static void mystery(int a, int b) {
	while (b != 0) {
		if (a > b) {
			System.out.print(a + " ");
			a = a - b;
		} else {
			System.out.print(b + " ");
			b = b - a;
		}
	}
	System.out.println(a);
}

1) mystery(42, 0);
2) mystery(6, 12);
3) mystery(18, 27);
4) mystery(24, 60);
5) mystery(50, 15);