Java Reference
In-Depth Information
6. Write nested for loops to produce the following output:
1
22
333
4444
55555
666666
7777777
7. Write nested for loops to produce the following output:
1
2
3
4
5
8. Write nested for loops to produce the following output:
1
22
333
4444
55555
9. Write nested for loops to produce the following output, with each line 40 characters wide:
----------------------------------------
_- -_- -_- -_- -_- -_- -_- -_- -_- -_- -
1122334455667788990011223344556677889900
----------------------------------------
10. It's common to print a rotating, increasing list of single-digit numbers at the start of a program's output as a visual
guide to number the columns of the output to follow. With this in mind, write nested for loops to produce the
following output, with each line 60 characters wide:
| | | | | |
123456789012345678901234567890123456789012345678901234567890
11. Modify your code from the previous exercise so that it could easily be modified to display a different range of
numbers (instead of 1234567890 ) and a different number of repetitions of those numbers (instead of 60 total
characters), with the vertical bars still matching up correctly. Use class constants instead of “magic numbers.” Here
are some example outputs that could be generated by changing your constants:
| | | | | | | | | |
12340123401234012340123401234012340123401234012340
| | | | | | |
12345670123456701234567012345670123456701234567012345670
12. Write nested for loops that produce the following output:
000111222333444555666777888999
000111222333444555666777888999
000111222333444555666777888999
Search WWH ::




Custom Search