Computer Science, asked by mds777, 2 months ago

Question: Design a java program to print the following pattern.
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1

Answers

Answered by ac240605
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();

}

}

}

Similar questions
Math, 2 months ago