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....


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)));




May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here