Question: Solve the following problem: Write a program that asks the user to enter the size of a triangle (an integer from 1 to 50). Display


Solve the following problem: Write a program that asks the user to enter the size of a triangle (an integer from 1 to 50). Display the triangle by writing lines of asterisks. The first line will have one asterisks, the next two, and so on, with each line having one more asterisk than previous line, up to the number entered by the user. On the next line write one fewer asterisks and continue by decreasing the number of asterisks by one for each successive line until only one asterisks is displayed. (Hint: Use nested for loops; the outside loop controls the number of lines to write, and the inside loop controls the number of asterisks to display on a line.) For example, if user enters 3, the output should be: k w This problem can be also found on page 257, problem #6 in your textbook. Add 5 comment lines (comment lines start with at the very top of your program with your name, your class and section, the project number, due date, and a short description of the program. Please submit the following file(s) to me on the due date. Soft copy of your program. That is, you need to submit your java file(s) using Canvas. 1. Detailed information for the proiect #4 Class name: TriangleOfAsterisks e
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
