Created
January 20, 2019 17:02
-
-
Save uysalserkan/4a3c02c79a9878f9431cef0afcc99946 to your computer and use it in GitHub Desktop.
Find the fibonacci value of the your integer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int TakeFibonacci(int num); | |
int main(void){ | |
int number; | |
cout <<"Please enter the number: "; | |
cin >> number; | |
cout << "Your number is: "<<number<<endl<< "Fibonacci number is: "<< TakeFibonacci(number)<<endl; | |
} | |
int TakeFibonacci(int num){ | |
if(num==1 || num==0) | |
return num; | |
return TakeFibonacci(num-1) + TakeFibonacci(num-2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment