Exercise on while loops: what will be printed by this program?

// What will be printed by the program? 

public class WhileLoopExercise {
    public static void main(String [] args) {
	int n = 2;
	int m = 15;
	while (n < m) {
	    n = n * 2;
	    m = m / 2;
	    System.out.println("n = " + n + " m = " + m);
	}
	System.out.println("After the loop: n = " + n + " m = " + m);
    }
}

This is an example from CSci 2101 course.

The views and opinions expressed in this page are strictly those of the page author. The contents of this page have not been reviewed or approved by the University of Minnesota.