Write a java program that uses nested for-loops to display a sequence of numbers. The program should ask the user to enter an integer n. The number n should be in the range 3 to 1000. If the number is not in the range, then display an invalid message and exit the program. Otherwise, on the first line, the program should display the number n repeated n times. Then on the neCt line it should display the number n - 1 repeated n-1 times, and on the next line it should display the number n -2 repeatedn -2 times, and so on for the next lines and stop when the number reaches zero. Also, display a star (*) before each line and display a hash (#) at the end of each line. See sample input/output on the right side SAMPLE INPUT/OUTPUT If n = 3 If n = 2 If n = 6 *3332 *224 Invalid *555554 *4444# *333# *224 number *1# *1#
Write a java program that uses nested for-loops to display a sequence of numbers. The program should ask the user to enter an integer n. The number n should be in the range 3 to 1000. If the number is not in the range, then display an invalid message and exit the program. Otherwise, on the first line, the program should display the number n repeated n times. Then on the neCt line it should display the number n - 1 repeated n-1 times, and on the next line it should display the number n -2 repeatedn -2 times, and so on for the next lines and stop when the number reaches zero. Also, display a star (*) before each line and display a hash (#) at the end of each line. See sample input/output on the right side SAMPLE INPUT/OUTPUT If n = 3 If n = 2 If n = 6 *3332 *224 Invalid *555554 *4444# *333# *224 number *1# *1#
C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section5.5: A Closer Look: Loop Programming Techniques
Problem 13E
Related questions
Question
100%
Java
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 4 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr