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

Assignment Help:

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


Related Discussions:- C program to print fibonacci series upto n using recursion

Decoding smugglers message, Smugglers are becoming very smart day by day. N...

Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new technology, they are send

C program for function of count the characters in each word, C Program for ...

C Program for FUNCTION OF COUNT THE CHARACTERS IN EACH WORD void count(char c[]); void main() {           char a[50];           int i=0;           clrscr();

Structures, A more advanced data type is the structure; here we can define ...

A more advanced data type is the structure; here we can define a template as a collection of different variables e.g.     struct birthdate   {     int month;     int day;

Assignment, write a c program chat illustrates the creation of child proces...

write a c program chat illustrates the creation of child process using fork system call. One process finds sum of even series and other process finds sum of odd series.

Can i overload operator == so it allow me compare two char[], Q: Can I over...

Q: Can I overload operator == so it allow me compare two char[] by a string comparison? A: No: at least one operand of particular overloaded operator should be of some user-defi

Program to calculate pie, This problem familiarizes you with using random n...

This problem familiarizes you with using random numbers in C++. The program is to compute a good approximation of π using a simulation method called "Monte Carlo". The following fi

Explain looping statements, Looping Statements The statements usually u...

Looping Statements The statements usually used for looping are for, do-while, while. The goto statement can be used for looping, but its use is generally avoided as it leads to

Described the scope resolution operator?, A: It allows a program to referen...

A: It allows a program to reference an identifier in global scope which has been hidden by another identifier along with the same name in the local scope.

All topics in c, Give practice in writing program''s..

Give practice in writing program''s..

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd