public class PrintPatterns{
public static void main(String[] args){
//Initialize count as 0
int count;
//set row as 0 as a start point
int row = 6;
//define i as char to display ascii variables
int i;
for(i = 1; i <= 6; i++){
for(count = 1; count <= 6; count++){
System.out.print(i+" ");
}
System.out.println(" ");
}
}
}
gives me
1 1 1 1 1 1
2 2 2 2 2 2
3 3 3 3 3 3
4 4 4 4 4 4
5 5 5 5 5 5
6 6 6 6 6 6
I want
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6
public class PrintPatterns{
public static void main(String[] args){
//Initialize count as 0
int count;
//set row as 0 as a start point
int row = 6;
//define i as char to display ascii variables
int i;
for(i = 1; i <= 6; i++){
for(count = i; count <= i; count++){
System.out.print(i+" ");
}
System.out.println(" ");
}
}
}
gives me
1
2
3
4
5
6
I still want
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6
though