WAP to print the the given pattern.
5 4 3 2 1
4 3 2 1
3 2 1
2 1
1
Answers
Answered by
1
Answer:
public class KboatPattern
{
public void displayPattern() {
for (int i = 1; i <= 5; i++) {
for (int j = 5; j >= i; j--) {
System.out.print(j + " ");
}
System.out.println();
}
}
}
OUTPUT
BlueJ output of Write a program in Java to display the following pattern: 5 4 3 2 1 5 4 3 2 5 4 3 5 4 5
Explanation:
In place of 5 write given numbers
Similar questions