Description: Below is a Java program that uses a while loop:
/**
* SquaringNumbers: Demonstration of while loop.
*/
public class SquaringNumbers {
public static void main(String[] args) {
int i = 1
while (i <= 10) {
System.out.println("The square of "+ i+ " is "+ i*i)
i++
}
}
}
Write a new version of the program above using a do-while loop and name its file SquaringNumbers1.java.
Write a new version of the program above using a for loop and name its file SquaringNumbers2.java.
To Search:
File list (Check if you may need any files):
SquaringNumbers1.class
SquaringNumbers1.java
SquaringNumbers2.class
SquaringNumbers2.java