- Refer to the program on slide #33. What happens if we make five changes
- the 'n' on line #16 to 'a';
- the 'n' on line #22 to 'b';
- the 'n' on line #28 to 'c';
- the 'n' on line #34 to 'd';
- the 'n' on line #40 to 'e',
and then run? What changes on other lines do we need in order to make the program work?
- Write a program that prints the following with as few repetitions as you can:
.oooooooooooooooooo.
.oooooooooooooooooo.
.oooooooooooooooooo.
.oooooooooooooooooo.
.oooooooooooooooooo.
.oooooooooooooooooo.
.oooooooooooooooooo.
.oooooooooooooooooo.
- Write a program that prints the following with as few repetitions as you can:
.o.o.o.o.o.o.o.o.o.o
.o.o.o.o.o.o.o.o.o.o
.o.o.o.o.o.o.o.o.o.o
.o.o.o.o.o.o.o.o.o.o
.o.o.o.o.o.o.o.o.o.o
.o.o.o.o.o.o.o.o.o.o
.o.o.o.o.o.o.o.o.o.o
.o.o.o.o.o.o.o.o.o.o
- Write a program that prints the following with as few repetitions as you can:
.ox.ox.ox.ox.ox.ox.ox
.ox.ox.ox.ox.ox.ox.ox
.ox.ox.ox.ox.ox.ox.ox
.ox.ox.ox.ox.ox.ox.ox
.ox.ox.ox.ox.ox.ox.ox
.ox.ox.ox.ox.ox.ox.ox
.ox.ox.ox.ox.ox.ox.ox
.ox.ox.ox.ox.ox.ox.ox
- Write a program that prints the following with as few repetitions as you can:
.ooxxx.ooxxx.ooxxx
.ooxxx.ooxxx.ooxxx
.ooxxx.ooxxx.ooxxx
.ooxxx.ooxxx.ooxxx
.ooxxx.ooxxx.ooxxx
.ooxxx.ooxxx.ooxxx
.ooxxx.ooxxx.ooxxx
.ooxxx.ooxxx.ooxxx
- Write a program that prints the following with as few repetitions as you can:
*...*****.......*********
*********.......*****...*
*...*****.......*********
*********.......*****...*
*...*****.......*********
*********.......*****...*
*...*****.......*********
*********.......*****...*
*...*****.......*********
*********.......*****...*
- Write a program that prints a multiplication table for 3:
- Write a program that prints the multiplication tables for 2, 3, 4, 5, 6, 7, 8 and 9:
1 | 2 | 2 |
2 | 2 | 4 |
3 | 2 | 6 |
… | | |
… | | |
12 | 2 | 24 |
1 | 3 | 3 |
2 | 3 | 6 |
3 | 3 | 9 |
… | | |
… | | |
12 | 3 | 36 |
1 | 4 | 4 |
2 | 4 | 8 |
3 | 4 | 12 |
… | | |
… | | |
12 | 4 | 48 |
1 | 5 | 5 |
2 | 5 | 10 |
3 | 5 | 15 |
… | | |
… | | |
12 | 5 | 60 |
1 | 6 | 6 |
2 | 6 | 12 |
3 | 6 | 18 |
… | | |
… | | |
12 | 6 | 72 |
1 | 7 | 7 |
2 | 7 | 14 |
3 | 7 | 21 |
… | | |
… | | |
12 | 7 | 84 |
1 | 8 | 8 |
2 | 8 | 16 |
3 | 8 | 24 |
… | | |
… | | |
12 | 8 | 96 |
1 | 9 | 9 |
2 | 9 | 18 |
3 | 9 | 27 |
… | | |
… | | |
12 | 9 | 108 |
- Write a program that prints a combined multiplication table for 2, 3, 4, 5, 6, 7, 8 and 9 as follows:
n | 2 | 2*n | 3 | 3*n | 4 | 4*n | 5 | 5*n | 6 | 6*n | 7 | 7*n | 8 | 8*n | 9 | 9*n |
1 | 2 | 2 | 3 | 3 | 4 | 4 | 5 | 5 | 6 | 6 | 7 | 7 | 8 | 8 | 9 | 9 |
2 | 2 | 4 | 3 | 6 | 4 | 8 | 5 | 10 | 6 | 12 | 7 | 14 | 8 | 16 | 9 | 18 |
3 | 2 | 6 | 3 | 9 | 4 | 12 | 5 | 15 | 6 | 18 | 7 | 21 | 8 | 24 | 9 | 27 |
… | 2 | | 3 | | 4 | | 5 | | 6 | | 7 | | 8 | | 9 | |
… | 2 | | 3 | | 4 | | 5 | | 6 | | 7 | | 8 | | 9 | |
12 | 2 | 24 | 3 | 36 | 4 | 48 | 5 | 60 | 6 | 72 | 7 | 84 | 8 | 96 | 9 | 108 |