Question
IN JAVA: Write a program that prompts the user for a number, reads in the value (say n) from the user and outputs the string
IN JAVA: Write a program that prompts the user for a number, reads in the value (say n) from the user and outputs the string Hello World X n times (e.g., If the input is 3, the output will be Hello World X, without the quotation marks, printed three times), where X is the loop iteration number, starting with 1. You must use a WHILE loop to do this. End the program with a Goodbye. HINT: You will need to make a counter that counts up in each loop iteration. Sample Input/Output The following below shows an example of what your console interaction should look like for a given example. Your output should match the output here exactly. Text that is bold represents text that is input to the program by the user.
How many times would you like to print "Hello World"?
5
Hello World 1
Hello World 2
Hello World 3
Hello World 4
Hello World 5
Goodbye.
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