Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Program to evaluate fibonacci series and checking whether or not it is fibonacci number

Posted By: Leslie Gordon     Category: C Programming     Views: 9773

Write a program to evaluate fibonacci series and checking whether or not it is fibonacci number

Code for Program to evaluate fibonacci series and checking whether or not it is fibonacci number in C Programming

#include<stdio.h>
#include<conio.h>
        
void main()
{
    longint a=0,b=1,i,sum,n,j=0,m;
    clrscr();
    printf(" Please Enter value for N: ");
    scanf("%ld",&n);
    printf("\n PLEASE ENTER THE CHECKING NO.: ");
    scanf("%ld",&m);
    printf("\n\n\t\t\t IT IS FEBONACCI SERIES \n  ");
    printf("%ld ,",a);
    printf("%ld ,",b);
    for(i=2;i<n;i++)
    {
        sum = a+b;
        a = b;
        b = sum;
        if(sum==m)
            j=1;
        printf("%ld ,",sum);
    }
    if(j==1)
        printf("\n\n\t\t\t %ld IT IS FEBONNACI NUMBER. ",m);
    else
        printf("\n\n\t\t\t %ld IT IS NOT FEBONNACI NUMBER. ",m);
    getch();
 }





************************************* OUTPUT **********************************

 Please Enter valuefor N: 9

 PLEASE ENTER THE CHECKING NO.: 21

   IT IS FEBONACCI SERIES


   0 ,1 ,1 ,2 ,3 ,5 ,8 ,13 ,21 

   21 IT IS FEBONNACI NUMBER.

*********************************************************************************
  
Share: 



Leslie Gordon
Leslie Gordon author of Program to evaluate fibonacci series and checking whether or not it is fibonacci number is from Wichita , United States. Leslie Gordon says

 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!