Today, We want to share with you **fibonacci series in c**.In this post we will show you What is the Fibonacci sequence? & **fibonacci series program in c using recursion**, hear for *Fibonacci Series generates subsequent number by including two previous numbers.* we will give you demo and example for implement.In this post, we will learn about *GO Program To Display Fibonacci Sequence* with an example.

## Fibonacci Series Program In C

Contents

each number is the sum of the two previous numbers. The first two numbers in the Fibonacci series are 0 and 1. Fibonacci series satisfies the following conditions β

Fn = Fn-1 + Fn-2

The beginning of the sequence is thus:

**0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, β¦β¦..**

**Algorithm**

Algorithm of this fibonacci series is very simply β

START Step 1 β Take integer variable A, B, C Step 2 β Set A = 0, B = 0 Step 3 β DISPLAY A, B Step 4 β C = A + B Step 5 β DISPLAY C Step 6 β Set A = B, B = C Step 7 β REPEAT from 4 - 6, for n times STOP

### Fibonacci Series up to n series

**Example 1: **

#include <stdio.h> int main() { int i, n, firstVal = 0, secondVal = 1, andThenValue; printf("Enter the number of series: "); scanf("%d", &n); printf("Fibonacci Series: "); for (i = 1; i <= n; ++i) { printf("%d, ", firstVal); andThenValue = firstVal + secondVal; firstVal = secondVal; secondVal = andThenValue; } return 0; }

**Output**

Enter the number of series: 10 Fibonacci Series: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34,

### Fibonacci Sequence Up to a Certain Number

**Example 2: **

#include <stdio.h> int main() { int firstVal = 0, secondVal = 1, andThenValue = 0, n; printf("Enter a positive number: "); scanf("%d", &n); printf("Fibonacci Series: %d, %d, ", firstVal, secondVal); andThenValue = firstVal + secondVal; while (andThenValue <= n) { printf("%d, ", andThenValue); firstVal = secondVal; secondVal = andThenValue; andThenValue = firstVal + secondVal; } return 0; }

**Output**

Enter a positive integer: 100 Fibonacci Series: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89,

### C Fibonacci Series Program using For Loop

**Example 3: **

#include <stdio.h> int main() { int Number, Next, i, First_Value = 0, Second_Value = 1; printf("\n Please Enter the Range Number: "); scanf("%d",&Number); for(i = 0; i <= Number; i++) { if(i <= 1) { Next = i; } else { Next = First_Value + Second_Value; First_Value = Second_Value; Second_Value = Next; } printf("%d \t", Next); } return 0; }

### Fibonacci series in C using Functions

#include<stdio.h> void ExampleOfFiboDemo_series(int Number) ; int main() { int Number; printf("Enter the number of series\n"); scanf("%d", &Number); printf("ExampleOfFiboDemo series First %d Numbers:\n", Number); ExampleOfFiboDemo_series(Number) ; return 0; } void ExampleOfFiboDemo_series(int Number) { int i, First_Value = 0, Second_Value = 1, Next; for(i = 0; i <= Number; i++) { if(i <= 1) { Next = i; } else { Next = First_Value + Second_Value; First_Value = Second_Value; Second_Value = Next; } printf("%d\t", Next); } }

### Fibonacci series in C using Recursion

#include<stdio.h> int ExampleOfFiboDemo_Series(int); int main() { int Number, i = 0, j; printf("\n Please Enter Number upto which you want too: "); scanf("%d", &Number); printf("Fibonacci series\n"); for ( j = 0 ; j <= Number ; j++ ) { printf("%d\t", ExampleOfFiboDemo_Series(j)); } return 0; } int ExampleOfFiboDemo_Series(int Number) { if ( Number == 0 ) return 0; else if ( Number == 1 ) return 1; else return ( ExampleOfFiboDemo_Series(Number - 1) + ExampleOfFiboDemo_Series(Number - 2) ); }

I hope you get an idea about **fibonacci series program in c using recursion**.

I would like to have feedback on my infinityknow.com blog.

Your valuable feedback, question, or comments about this article are always welcome.

If you enjoyed and liked this post, donβt forget to share.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I’m a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.