Computer Science, asked by WhOH, 2 days ago

Write a program in Java to print following pattern:-

5
4 5
3 4 5
2 3 4 5
1 2 3 4 5

Answers

Answered by alokmemane
0

Answer:

public class KboatPattern

{

public void displayPattern() {

for (int i = 0; i < 5; i++) {

for (int j = i; j > 0; j--) {

System.out.print(" ");

}

for (int k = 5 - i; k > 0; k--) {

System.out.print((5 - i) + " ");

}

System.out.println();

}

}

}

Similar questions