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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started