I can not figure out what is the prooooblem... Please help...
I need this
pattern 1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6
and here is my code...
import javax.swing.JOptionPane;
public class forLoop {
public static void main(
String[] args) {
int row;
int column;
String outputPattern = "Pattern I\n";
for (row = 1; row <= 6; row++) {
for (column = 1; column <= row; column++) {
outputPattern += column + " ";
}
outputPattern += "\n";
System.out.println(outputPattern);
}
}
}
Instead of looking like the above pattern, it looks like:
Pattern I
1
Pattern I
1
1 2
Pattern 1
1
1 2
1 2 3
etc... etc... etc...
Please show me what a little mistake I am making...
Thanks in advance