Write a program in Java to display the following pattern:
1 2 3 3 4 5 4 5 6 7 5 6 7 8 9
Java
Java Nested for Loops
25 Likes
Answer
publicclassKboatPattern{publicstaticvoidmain(String args[]){for(int i =1, j =1; j <=5; j++, i +=2){for(int k = j; k <= i; k++)System.out.print(k +" ");System.out.println();}}}