Output:
Click Here For Java Online Compiler
Solution:
12345 2345 345 45 5 45 345 2345 12345
Click Here For Java Online Compiler
Solution:
class NumberPattern { 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(" "); } for (int j = i; j <= rows; j++) { System.out.print(j); } System.out.println(); } for (int i = rows - 1; i >= 1; i--) { for (int j = 1; j < i; j++) { System.out.print(" "); } for (int j = i; j <= rows; j++) { System.out.print(j); } System.out.println(); } } }
comment 0 comments:
more_vertsentiment_satisfied Emoticon