Comment on Tutorial - C++ Recursion function explained using Fibonacci series By Emiley J



Comment Added by : Tahani

Comment Added at : 2011-04-26 11:55:34

Comment on Tutorial : C++ Recursion function explained using Fibonacci series By Emiley J
my answer for this Question is :

#include <iostream>
using namespcae std;

in fib (int n)
{
if (n==0)
return 1;
else
return fib(n-1)+fib(n-2);
}


int main()
{
int x;
cout<<"please enter a number"<<endl;
cin>>x;
cout<<"The fibonacci of "<<x<<"is"<<fib(x);

return 0;
}


View Tutorial



Subscribe to Tutorials

Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. Thank you very much..
This helped me a lot

View Tutorial          By: Rabeea AS at 2010-11-15 00:28:29

2. The example is wrong, because there are two sepera
View Tutorial          By: billGates at 2010-07-06 16:56:13

3. Very Useful tutorial for beginners.. Thanx
View Tutorial          By: Rohini at 2010-02-23 23:16:16

4. it was nice and helpful for me.
View Tutorial          By: mayank at 2015-03-01 08:35:48

5. I have one doubt from drop down box, i have two va
View Tutorial          By: subash at 2008-11-09 22:27:45

6. hi,
there is no main method in SMSClient.ja

View Tutorial          By: raju at 2010-01-22 08:28:45

7. I am geting following exception
javax.comm

View Tutorial          By: Raviteja at 2014-06-23 12:46:06

8. excellent code.....
View Tutorial          By: Anonymous at 2009-05-07 03:09:01

9. thanks for all samples..
View Tutorial          By: 珠洲市 at 2013-03-01 09:47:46

10. I have initialized a int array while declaring.
View Tutorial          By: Prashanth at 2011-09-15 11:16:40