Exercises for Introduction to Programming

Each exercise is listed with the expected output below it.  The link takes you to a page with the source code for that exercise.

integers.cpp Write a program to print the whole numbers from 0 to 20, one per line power.cpp Write a program to print the whole numbers from 0 to 20, along with their 2nd, 3rd, and 4th powers. fibonacci.cpp Write a program to print the first 20 numbers in the Fibonacci series (start with 1 and 1, then each number is the sum of the previous two numbers).
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
0 0 0 0
1 1 1 1
2 4 8 16
3 9 27 81
4 16 64 256
5 25 125 625
6 36 216 1296
7 49 343 2401
8 64 512 4096
9 81 729 6561
10 100 1000 10000
11 121 1331 14641
12 144 1728 20736
13 169 2197 28561
14 196 2744 38416
15 225 3375 50625
16 256 4096 65536
17 289 4913 83521
18 324 5832 104976
19 361 6859 130321
20 400 8000 160000
1
1
2
3
5
8
13
21
34
55
89
144
233
377
610
987
1597
2584
4181
6765