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