Fibonacci Sequence
Learn to find patterns by working out the solution for the Fibonacci sequence.
Problem
Start with a pair of rabbits (one male and one female) born on January 1. Assume that all months are of equal length and that:
The first pair of rabbits reproduced two months after their own birth.
After two months of age, each pair produces a mixed pair (one male and one female), and then another mixed pair every month.
No rabbit dies.
Find out how many pairs will there be at the end of each month of the first year. Store the numbers in an array called array
.
Access this course and 1400+ top-rated courses and projects.