(1) Type in and run the following program computing squares of int numbers. Example: > ./program Insert the number of squares desired: N Output: 1 4 9 16 ... N2 |
Source Code |
(2) The Fibonacci series is defined by the relation xm+2 = xm+1 + xm. Starting with x0 = 1 and x1 = 1 write down the first few terms of the series by hand. Modify the above program so that it instead computes the first 10 Fibonacci numbers. Example: > ./program Output: 1 1 2 3 5 8 13 21 34 55 |
Source Code |
(3) Type in and run the following program, again computing squares of int numbers. This time a function double mySquare is used. Example: > ./program Insert the number of squares desired: N Output: 1 4 9 16 ... N2 |
Source Code |