C program to Generate Fibonacci Series starting from any two numbers

C program to Generate the Fibonacci Series starting from any two numbers

The C program to Generate the Fibonacci Series starting from any two integer numbers. The Fibonacci series is a series of numbers in which each number of the Fibonacci series is derived by the adding of its two immediate preceding numbers. ThiscC program will Generate the Fibonacci Series starting from given any two integer numbers , and add the given two numbers to generate the third number in the series, and so on. For example: If we give the starting numbers are 3 and 5 then the Fibonacci Series will be 3, 5, 8, 13, 21, . . . . The below given C program to Generate the Fibonacci Series starting with any two integer numbers. Kindly check out the program to generate the fibonacci series starting with any two integer numbers.


Program to Fibonacci Series starting with any two integer numbers


    #include<stdio.h>
    int main(){
                  int n, firstnumber, secondnumber, sum;
                  printf("How many Fibonacci terms to display : ");
                  scanf("%d", &n);
                  printf("\n Give First Number : ");
                  scanf("%d", &firstnumber);
                  printf("\n Give Second Number : ");
                  scanf("%d", &secondnumber);
                  printf("\n The Fibonacci Series is . . . \n");
                  printf("\n %d %d ", firstnumber, secondnumber);
                  while (n>2){
                  sum = firstnumber + secondnumber;
                  printf("%d ", sum);
                  firstnumber = secondnumber;
                  secondnumber = sum;
                  n--;
                  }
    return (0);
    }


Sample Output:

                  How many Fibonacci terms to display : 7
                  Give First Number : 3
                  Give Second Number : 6     
                  The Fibonacci Series is . . .
                                  3 6 9 15 24 39 63


Related Popular Posts:

Other Related C Programs :


* C Program to find whether the given number is Odd or Even

* C Program to find the Sum of Odd Digits

* C Program to find the Sum of Even Digits

* C Program to find the Sum of Even and Odd Digits,

* C Program to Display Odd digits

* C Program to Display even digits

* C Program to Display Odd Numbers,

* C Program to Display Even Numbers,

* C Program to Check whether the given number is Armstrong number

* C Program to display the Armstrong numbers in Range

* C Program to display the Armstrong numbers between 1 and 1000

* C Program to check perfect number, perfect numbers in range

* C Program to Check Prime number, Prime numbers between 1 and 100

* C Program to display the Prime numbers in a Range

* C Program to display the Sum of Prime numbers

* C Program to Check Strong number

* C Program to display the Strong number in Range

* C Program to Check whether the given number is polindrome number or not

* C Program to Check polindrome number using for loop

* C Program to Check polindrome number using Recursion

* C Program to  check whether the given string is polindrome or not

* C Program to find the Roots of Quadratic equation

* C Program to display Fibonacci Series

* C Program to display the Fibonacci Series using an array

* C Program to display the Fibonacci Series using while loop

* C Program to find the Sum of Fibonacci Series, Factorial of Number

* C Program to find the Factorial without using Recursion

* C Program to find the Factorial using Pointers

* C Program to find the Factorial using Function

Bookmark and Share