# Fibonacci Series C Program

By | September 21, 2015

Let us learn how to print Fibonacci series in C programming language. It is important that we should know how a for loop works before getting further with the fibonacci sequence code.

#### What is a Fibonacci sequence?

A Fibonacci series is a sequence of numbers in which the next number is found by adding the previous two consecutive numbers.

Note: The first two digits in a Fibonacci series is always 0 and 1.

The first digit in a Fibonacci sequence is 0 and the second digit as 1. The next digit or the third element is dependent upon the two preceding elements. The third element is, therefore, the sum of the previous two digits. This addition of previous two digits continues till the limit defined by the user.

The third element is, therefore, the sum of the previous two digits. This addition of previous two digits continues till the limit defined by the user.

#### Example

0 1 1 2 3 5 8

Note: This code to display Fibonacci series in C programming has been compiled with GNU GCC compiler and developed with gEdit Editor in Linux Ubuntu operating system.

#### Output

There’s a trick with the Fibonacci sequence. The consecutive terms in a fibonacci sequence can be made to convert miles to kilometers. This has been properly demonstrated in Zeckendorf’s Theorem.

Let us take 5 and 8, which are consecutive terms in a fibonacci series.  But, 5 Miles = 8 Kilometres. Similarly, 8 Miles = 13 kilometres.

In case you get any compilation errors in the above code to print fibonacci sequence in C programming using while loop and for loop or if you have any doubts about it, let us know about it in the comment section below.

## 25 thoughts on “Fibonacci Series C Program”

1. Parag Vidhate

Excellent! Thanks!

1. Tushar Soni Post author

You’re welcome.

2. Shanmukha Srinivas

Thanks for multiple methods!

1. Tushar Soni Post author

You’re welcome Shanmukha. Our main reason to post multiple methids is to help the students understand the differences between them which will help then to clear basic concepts.

3. Rajeshwari Naraparaju

Please provide Codes for Series programs in C.

1. Tushar Soni

Sure! You can check for them in the C Programs Menu Header

2. Tushar Soni Post author

Its already there on our website. Make a search related to Sum of Series in C our Search bar.

4. Harish Vaidya

1. Tushar Soni Post author

You’re welcome. Find more updated C Programs on codingAlpha.

5. Akshay Patwardhan

Can we solve Fibonacci Series C Program using Recursion method?

1. Tushar Soni Post author

Yes Akshay. Almost all the For Loops, While Loops can be converted into Recursion methods. You just need to understand Recursion properly.

6. Nayan Patil

Is this a common interview question? My teachers told that it is frequently asked in interviews.

1. Tushar Soni Post author

It depends on the interviewer. But, you should understand the logic of Fibonacci Series. It is not that difficult.

7. Rajesh Makhija

Thanks. You have made this logic for Fibonacci series quite simple to understand.

8. Pankaj Dhende

Perfect code examples for Fibonacci Series in C. Thank you very much.

9. Ashish Kediya

When we have written this code
first = second;
second = third;
count++;
then why do we need to take the value of first and second as 1 and 0 at initialization in this fibonacci c program?

10. Krishna Kunal

Thanks for the fibonacci series logic. This is too good program!

11. Vikash Kumar

Instead of hard coding the first and second values of the fibonacci sequence, why not take the values from the user itself. Just in case he/she wants to begin the fibonacci sequence after a certain number, it would be much easier to code it in C language.

12. Diksha Tandon

Thanks for this. It is so nice of you to code and publish different methods for every given program. Keep it up.

13. Vishal Shelke

Nice explanation.

14. Akshay Bramhe

Nice code for Fibonacci sequence. So self explanatory.

15. Mahesh

Thank you sir you are a man who was born for programming

16. Prasad Reddy

Why don’t you use recursion method to print the fibonacci series. The code becomes much easier and simpler.

17. Gurpreet Sodhi

What is a Tribonacci Series? Is it something related to Fibonacci sequence?

1. Kaustubh Bansod

Yup. In fibonacci sequence, you take two digits’ sum as the next digit. However, in tribonacci series, you take first digits’s sum for the next digit.