Example 32: Fibonacci Series
Learn how to print a Fibonacci series.
We'll cover the following
Problem
Fibonacci series is a series in which each number is the sum of the two preceding ones, starting from 1 and 1.
Write a program to print the first 10 terms of the Fibonacci series.
Example
Input | Output |
---|---|
Nil | 1 1 2 3 5 8 13 21 34 55 |
Try it yourself
Try to solve this question on your own in the code widget below. If you get stuck, you can always refer to the solution provided.
Get hands-on with 1400+ tech skills courses.