C Program to Generate the Fibonacci series

In this program you will learn how to generate the fibonacci series using c.
Lets Start Fibonacci series is a sequence of numbers in which the next number is generate by adding previous two numbers.

For example 0, 1, 1, 2, 3, 5, 8, 13, 21, 34.

C Program to Generate the Fibonacci series

ALGORITHM:-

Step 1: Initialize the variables i=0, j=1, add=0
Step 2: Enter the number of term
Step 3: Print the first and second number
Step 4: Start loop and add = i + j
Step 5: i = j, j = add and print the add
Step 6: Repeat the step 4 until loop is not terminate
Step 7: End

PROGRAM CODE:-

#include <stdio.h>
#include <conio.h>
void main()
{
    int i = 0, j = 1, a, r, f;
    clrscr();
    printf("enter the range");
    scanf("%d", &r);

    printf("%d", i);
    for(a = 2; a < r; a++)
    {
        f = i + j;
        i = j;
        j = f;
        printf("%d, ", i);
    }
    getch();
}

OUTPUT:-

enter the range: 10
0, 1, 1, 2, 3, 5, 8, 13, 21, 34
C program to generate the fibonacci series
How to generate fibonacci series using c
fibonacci sequence in c programming
C program to generate the fibonacci series within given range