Ok, I need help on a for loop nested program using for loops, I'm trying to use a patten that goes like this:
123456
12345
1234
123
12
1
but when I try it, it goes like this:
123456
12345
1234
123
12
1
This is my program:
public class Patterns{
public static void main (String [] args) {
//set up for the rows
for(int row = 7 ; row > 1; row--){
for (int num = 1; num < row; num++){
System.out.prin t(num);
}
System.out.prin tln();
}
}
}
Can anybody help please? thanks
123456
12345
1234
123
12
1
but when I try it, it goes like this:
123456
12345
1234
123
12
1
This is my program:
public class Patterns{
public static void main (String [] args) {
//set up for the rows
for(int row = 7 ; row > 1; row--){
for (int num = 1; num < row; num++){
System.out.prin t(num);
}
System.out.prin tln();
}
}
}
Can anybody help please? thanks
Comment