Question: 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
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 asterisk, the next two, and so on, with each line having one more asterisk than the previous line, up to the number entered by the user. On the next line write one fewer asterisk and continue by decreasing the number of asterisks by 1 for each successive line until only one asterisk is displayed. 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 the user enters 3, the output would be
*
**
***
**
*
Step by Step Solution
3.35 Rating (164 Votes )
There are 3 Steps involved in it
public class TriangleOfAsterisks public static void ... View full answer
Get step-by-step solutions from verified subject matter experts
