Hi all,
I'm finding it difficult to get my head around the concept, but i managed to construct this for a section of my weekly assignment.
class Q4d { public static void main (String [] args) { int numberOfLines = 6; // Pattern D System.out.println(); System.out.println("Pattern D"); //Getting correct number of rows for (int lines = 1; lines <= numberOfLines; lines++) { //getting correct number of columns for (int columns = 1; columns <= numberOfLines - lines; columns++) { System.out.print(" "); } //getting figures for (int number = 1; number <= lines; number++) { System.out.print(number + " "); } System.out.println(); } } } Output = Pattern D * * * * * 1 * * * * 1 2 * * * 1 2 3 * * 1 2 3 4 * 1 2 3 4 5 1 2 3 4 5 6
The next question is asking me to present the same thing, only upside down.
I'm not sure on how to do this.
Any pointers in the right direction?