Unit 2 Task 40: Fibonacci rabbit pairs (small n)

Learn to code with step-by-step lessons. A place for students to work through programming fundamentals and build skills.

Unit 2 Task 40 - Fibonacci rabbit pairs (small n)

← Unit 2 tasks · Solution


A classic simplified model: each month’s pairs follow Fibonacci. Ask for n (how many terms, at least 2). Print the first n Fibonacci numbers starting 1, 1 (or 0, 1 if your class prefers-pick one and be consistent).

Use a loop; only store what you need (two variables for “previous” and “current” is enough).

Skills: for, updating two variables.