C program to print fibonacci series, C/C++ Programming

C program to print fibonacci series:

int fibo(long int);

void main()

{

                long int a=0,n;

                printf ("how many terms\n");

                scanf("%d",&n);

                for(int i=1;i<=n;i++)

                {a=fibo(i);

                printf("%d ",a);

                }

}

fibo(long int m)

{

                long int x;

                if(m>2)

                {

                x=fibo(m-1)+fibo(m-2);

                return x;

                }

                else if(m==2)

                                return 1;

                else if(m==1)

                {return 0;}

}

 

Posted Date: 9/29/2012 7:24:36 AM | Location : United States







Related Discussions:- C program to print fibonacci series, Assignment Help, Ask Question on C program to print fibonacci series, Get Answer, Expert's Help, C program to print fibonacci series Discussions

Write discussion on C program to print fibonacci series
Your posts are moderated
Related Questions
What is the specialty in sizeof() operator

Write a program that finds the minimum total number of shelves, including the initial one required for this loading process.


i need amibroker afl to dll plugin

the issue of oil spills

#write code for rotation in c

A string S is said to be "Super ASCII", if it contains the character frequency equal to their ascii values. String will contain only lower case alphabets (''a''-''z'') and the asci

conceptual difference between big o,big thete and big omega

Pebble Merchant Problem Description There is a pebble merchant. He sells the pebbles, that are used for shining the floor. His main duty is to take the length of the room’s sides