Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class NumbersTriangle_19 {
- public static void main(String[] args) {
- int rows = 5;
- for (int i = 1; i <= rows; ++i) {
- for (int j = 1; j <= i; ++j) {
- System.out.print(j + " ");
- }
- System.out.println();
- // follows The reversed part Triangle
- // How to merge the two triangles?
- //Some interruption(if/then)after the first triangle prints the max row number?/
- for (int i = rows; i >= 1; --i) {
- for (int j = 1; j <= i; ++j) {
- System.out.print(j + " ");
- }
- System.out.println();
- }
- }
- }
- }
- // Resources used : https://www.programiz.com/java-programming/examples/pyramid-pattern
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement