Monday's Programming Question
No code to tinker with this week. This time you have to write the code from scratch. When I first started programming this was one of the tasks I was given. It's a simple exercise to get you thinking about logic, loops and variables.
The task it is to write a program that calculates and displays the first 22 numbers of a Fibonacci sequence. The sequence is the result of Fibonacci's attempt in 1202 to find out how many rabbits you get after a certain number of generations. Each number represents how many pairs of rabbits there would be when they are breeding under ideal circumstances. In a Fibonacci sequence each number is the sum of the previous two numbers (i.e., it starts with 0,1,1,2,3,5,8 and continues on).
Your code will display Fibonacci's hypothesis for 20 generations of rabbits (the first two numbers represent the start of the population and the maturing of the first pair of rabbits).


No comments yet. Leave a Comment