Fibonacci Program in C Programming

By | June 22, 2019

What is Fibonacci Sequence

Explain Fibonacci Series

What are Fibonacci Numbers

This program with title “Fibonacci Program in C Programming” is based on a special series in mathematics. The Fibonacci sequence is a series of numbers starting from first two numbers 0 and 1 by definition. Then every other number is the sum of  previous two numbers. 0,1,1,2,3,5,8,13 … and so on.

How Fibonacci sequence explained

Fibonacci sequence example series up to 610

This is Fibonacci sequence example series from n=0 to n=15  the fib number goes from 0 to   610 in 15th fib term. The numbers in Fibonacci sequence are called fib numbers.

The popular Wikipedia says about Fibonacci Sequence : In mathematics, the Fibonacci numbers, commonly denoted Fn form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, starting from 0 and 1. That is

"<yoastmark

Why This Series is Called Fibonacci?

About the Man Behind Fibonacci
His real name was Leonardo Pisano Bogollo from Italy (1170-1250). “Fibonacci” was his nickname. He is famous for Fibonacci series and he also worked for Arab-Hindu numerals like the numbers we use now a days that is 0,1,2,3,4,5,6,7,8,9 and helped spread them in Europe instead of Roman Numerals like I,II,III,IV,V etc.

Fibonacci sequence generator program in C Programming

This C program with title “Fibonacci Program in C” displays the fib numbers up to n number of terms.

/* 
Write a C program to show Fibonacci series
upto given number of terms entered by user.
*/  
#include <stdio.h>
int main()
{
    int i, n, term1 = 0, term2 = 1, nextTerm;
    printf("Enter the number of terms: ");
    scanf("%d", &n);
    printf("The Required Fibonacci Series:\n ");
    for (i = 1; i <= n; ++i)
    {
        printf("%d, ", term1);
        nextTerm = term1 + term2;
        term1 = term2;
        term2 = nextTerm;
    }
    return 0;
}
/*Output:
Enter the number of terms: 7
The Required Fibonacci Series:
0, 1, 1, 2, 3, 5, 8
*/

Here is an image to show sample run and output of fib numbers c program:

output of fibonacci program in C

output of fibonacci program in C

Loading

2 thoughts on “Fibonacci Program in C Programming

  1. Pingback: Print Fibonacci Series Up to n - C Programming » EasyCodeBook.com

  2. Pingback: Python Program Fibonacci Series Function | EasyCodeBook.com

Leave a Reply

Your email address will not be published. Required fields are marked *