C program to print fibonacci series upto n using recursion, C/C++ Programming

C program to Print Fibonacci series upto n using recursion:

int fibo(long int);

void main()

{

                long int a=0,n;

                printf ("how many terms");

                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;}

}

OUTPUT

1912_fabonacci serise.png

Posted Date: 9/29/2012 7:27:33 AM | Location : United States







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

Write discussion on C program to print fibonacci series upto n using recursion
Your posts are moderated
Related Questions
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

write a promgram using object oriented peramid


Is it possible to have Virtual Constructor? If yes, how? If not, Why not possible?

Reference Types The symbol "&" is interpreted as an address operator as well as AND operator. This operator is also used to declare a "reference variable". A reference is refer

A Network of routers have been configured for the purposes of handling data traffic within your company. You would like to have an application that does a network

Precedence and Order of evaluation The languages follow a standard precedence for basic operators. Precedence rules help in deleting ambiguity of the order of operations perfor

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. But he sometimes mistakes doing that

Write a function that has int parameter n, makes another type of mask having n bit 1's from the left most bit and 32- n bit 0's next. The mask is called netmask in this seminar, an

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec