Hi guys, i'm trying to print a triangle (which is taken from a command line argument) so that its longest row is at the top and the right hand side straight.
I'm guessing another loop is required:
public class PrintTriangleMirror
public static void main(String  args)
int height = Integer.parseInt(args);
for (int row = 1; row <= height; row++)
for (int column = 1; column <= row; column++)
So do you have any suggestions on how to flip the triangle. I know another for loop is required... and you can think about the spaces.
So you can use a for loop... but i dont what to include in it.
You marked the wrong thread as solved and haven't used code tags yet.... :)
Yeah i know sorry, and i have edited the code and use code tags if you may look :). i used code and /code
How about having two inner for loops in a row, one to print spaces, the other to print your lines:
outer loop -- loop through the rows
inner loop 1
end inner loop 1
inner loop 2
end inner loop 2
end outer loop