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
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
Math,
1 day ago
English,
1 day ago
Social Sciences,
2 days ago
Math,
8 months ago
Math,
8 months ago