class NumberDemo{ public static void main(String[] args) { int i, j, row=5; for (i=1; i<=5 ;i++ ) { for (j=1; j<=row ; j++ ) { System.out.print(j +" "); } System.out.println(); row--; } } }Output:1 2 3 4 51 2 3 41 2 31 21 Read more
No comments:
Post a Comment