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

}

Modify the program with if-else statement within the for-loop which changes the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!