Sunday, May 5, 2013

Program to find the given number is Fibonacci number or not.


#include<stdio.h>
#include<conio.h>
int main()
{
    int n,t,f=1;
    clrscr();
    printf("Enter Value");
    /*Read the n value */
    scanf("%d",&n);
    /*Logic for factorial */
    for(t=n;t>0;t--)
    {
       f=f*t;
    }
    printf("The factorial of the %d is %d",n,f);
getch();
}

output

Enter Value5
The factorial of the 5 is 120

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More