1. Squaring numbers Write a program to display the numbers 1 to 5 and their squares, one number (and its square) per line in a text area. Use the string "\n" to move to the start of a new line.
2. Rewrite the stars program using while instead of for.
3. What is displayed when the following statements are executed?
int n, m;
n = 10;
m = 5;
while ((n > 0) || (m > 0)) {
n = n - 1;
m = m - 1;
}
JOptionPane.showMessageDialog(null,
("n = " + Integer.toString(n) +
" m = " + Integer.toString(m)));
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here