Wednesday, 10 September 2014

Fibonacci series upto ‘n’ numbers in C language With Example

C Language program for Fibonacci series upto ‘n’ numbers. It is a simple source code that provides the output of an actual Fibonacci sequence up to n numbers. For this C program, questions may asked like “write a C program to find the Fibonacci series & sample Fibonacci program in C“. Take care of a questions for your interviews or students exam. This is a totally free of cost code.

Create a Fibonacci series up to n numbers in C program. It is used to create the Fibonacci series in any particular range of value or up to n terms by looping statement. Basic condition is (cn=2;cn<rge;cn++).

//Header files
#include <stdio.h>
#include <conio.h>
void main()
    //Program variables
    int cn,rge,num1=0,num2=1,num3;
    clrscr(); //Function to clear previous output

    //Display function
    printf("Enter the range of Fibonacci series to generate : ");
    scanf("%d",&rge); //Getting input function
    //Creating fibonacci series.
    for(cn=2;cn<rge;cn++) //Looping statement

No comments:

Post a comment

Note: only a member of this blog may post a comment.