
1 1 2 3 1 2 3 4 1 2 3 4 5
1 2 3 3 4 5 4 5 6 7 5 6 7 8 9 6 7 8 9 10 using for loop in java

Java Number Pattern
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
public class PatternExample{
public static void main(String[] args){
for(int i=1;i<=5;i++){
for(int j=1;j<i+1;j++){
System.out.print(j);
}
System.out.println();
}
}
}

Java Number Pattern
1
2 3
3 4 5
4 5 6 7
5 6 7 8 9
6 7 8 9 10
public class PatternExample{
public static void main(String[] args){
StringBuffer buffer=new StringBuffer();
int size = 6;
int c;
for(int row = 1; row <= size; ++row){
c = row;
for(int j = 0; j < row; ++j){
buffer.append(c);
if(++c > 9){
c = 10;
}
}
buffer.append("\n");
}
System.out.println(buffer.toString().replace("1010","10"));
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.