Question: Modify the program with if-else statement within the for-loop which changes the output for each iteration. The if-else should be controlled by a value received
Modify the program with if-else statement within the for-loop which changes the output for each iteration. The if-else should be controlled by a value received from the user as input.
________________________________________________________________________________________________________________________________________________
import java.util.Scanner; public class DiscWeek5 {
public static void main(String[] args) { // variables int input, count, total = 0;
// scanner class Scanner scan = new Scanner(System.in); // prompt user for number squared System.out.print("How many numbers would you like to square: "); input = scan.nextInt(); // setting the table System.out.println(); System.out.println("Number Number Squared"); System.out.println("**************************"); // for loop for (count = 1; count
// close input scanner scan.close(); }
}

Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
