Menu

[solved] – Question 844

Write a java program. User enters size of a triangle from 1-50. Print the triangle in asterisks. The user’s input is the middle of the triangle. For example, if the input is 3, the triangle will look like this:
*
**
***
**
*
You have to use nested for loops. So far i did the top half of the triangle:

for(row = 1; row <= size; row++)
{
for(col = 1 ; col <= row ; col++)
{
System.out.print(“*”);
}
System.out.println();
}
Now i have to do the bottom half and do not know how.

Expert Answer


OR


Leave a Reply

Your email address will not be published. Required fields are marked *