Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

}

image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions