Comment on Tutorial - C++ Recursion function explained using Fibonacci series By Emiley J
Comment Added by : nadia
Comment Added at : 2010-10-04 21:48:04
Comment on Tutorial : C++ Recursion function explained using Fibonacci series By Emiley J
how about this?...
#include<iostream.h>
int fibonacci(int n);
int main()
{
int number;
cout <<"Enter an integer :";
cin >> number;
for(int i=0;i<=number;i++)
{
cout <<fibonacci(i) <<" ";
}
cout << endl << endl;
for(i=0;i<=number;i++){
cout <<"Fibonacci "<< i <<" is "<< fibonacci(i) <<endl;
}
return 0;
}
int fibonacci(int n) {
if (n <= 1) {
return n;
} else {
return fibonacci(n-1)+fibonacci(n-2);
}
}
View Tutorial
- Data Science
- Android
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview
categories
Related Tutorials
Java program to get location meta data from an image
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
Count number of vowels, consonants and digits in a String in Java
Student marks calculation program in Java
Calculate gross salary in Java
Calculate average sale of the week in Java
Vector in Java - Sample Program
Archived Comments
1. i need a source to send and receive SMS through th
View Tutorial By: morteza at 2010-03-03 01:53:09
2. how do i cast the contents of the arraylist to dou
View Tutorial By: ronnie at 2010-01-27 00:04:25
3. Any thoughts on how conservative/liberal to be whe
View Tutorial By: Jon at 2009-05-04 15:29:14
4. Thanks for this. I was checking and double checkin
View Tutorial By: Alex at 2011-07-10 09:03:56
5. The above codes is working for me~
yeah, wh
View Tutorial By: rejectee at 2009-10-23 22:14:25
6. M having query
i wat to create employee cla
View Tutorial By: Dayasagar at 2010-05-22 16:18:17
7. Hi Maybelline, This is the <a href="http:/
View Tutorial By: Daniel Malcolm at 2008-08-21 06:57:31
8. I have a problem , i cant see the Microsoft.Office
View Tutorial By: Japz at 2012-01-16 09:51:11
9. hello
i am developing a budget application
View Tutorial By: anu at 2010-04-16 04:26:36
10. Hi Chriz,
Yes it should work on any site. B
View Tutorial By: William at 2010-07-10 20:54:24