Print the following pattern in java.
1 2 3 4 5
2 3 4 5
3 4 5
4 5
5
Answers
Answered by
1
Answer:
public class Main {
public static void main(String[] args) {
int rows = 5;
for (int i = rows; i >= 1; --i) {
for (int j = 1; j <= i; ++j) {
System.out.print(j + " ");
}
System.out.println();
}
}
}
Explanation:
Answered by
5
Answer:
Your answer is in the attachment.
Output also see.
Note:that j=i I have written not 1
Attachments:
Similar questions