NESTED LOOP
PROGRAMS on nested ‘for’ loop:
I - Write programs on following patterns:
1. * 2. ***** 3. 1 4. 54321
** **** 21 5432
*** *** 321 543
**** ** 4321 54
***** * 54321 5
5. 1 6. a 7. ZZ…ZZ 8. Z
22 ab Y…..Y yz
333 . . .
4444 . . .
55555 ab….yz BB ab…yz
A
9. 97531 10. 0 11. 8 12. 11111
7531 22 68 3333
531 444 468 555
31 6666 2468 77
1 88888 02468 9
13. 1 14. 10987 15. A 16. 5*4*3*2*1*
23 654 BC 4*3*2*1*
456 32 DEF 3*2*1*
78910 1 GHIJ 2*1*
KLMNO 1*
17. *9 18. 19. 0
*99 2 01
*999 4 6 012
*9999 8 10 12 0123
*99999 14 16 18 20 012
01
0
20. * 21. ***** 22. 5 23. 12345
** **** 44 1234
*** *** 333 123
**** ** 2222 12
***** * 11111 1
24. z 25. AAAAA
yz BBBB
xyz CCC
wxyz DD
vwxyz E
uvwxyz
26. Write a program in Java to print either of the following patterns for n lines, depending on
the user’s choice:
(a) 2 4 6 8 (b) 1
4 6 8 2 3
6 8 4 5 6
8 7 8 9 10