In this assignment, you have to try two different loop controllers.
1. Use a while
loop to create the following table: the x is
from 1 to 10.
2. Use a for
loop to create the following table: the
x is from 11 to 20.
i square cube double triple
1 1 1 2 3
2 4 8 4 6
3 9 27 6 9
4 16 64 8 12
5 25 125 10 15
6 36 216 12 18
7 49 343 14 21
8 64 512 16 24
9 81 729 18 27
10 100 1000 20 30
11 121 1331 22 33
12 144 1728 24 36
13 169 2197 26 39
14 196 2744 28 42
15 225 3375 30 45
16 256 4096 32 48
17 289 4913 34 51
18 324 5832 36 54
19 361 6859 38 57
20 400 8000 40 60
Hint:
1. You have to set up your counter and initialize it before the while
loop.
2. You check the condition in the ( ).
3. Before you close your while loop, you increase your counter.