Skip to content

Instantly share code, notes, and snippets.

@uysalserkan
Created January 20, 2019 17:02
Show Gist options
  • Save uysalserkan/4a3c02c79a9878f9431cef0afcc99946 to your computer and use it in GitHub Desktop.
Save uysalserkan/4a3c02c79a9878f9431cef0afcc99946 to your computer and use it in GitHub Desktop.
Find the fibonacci value of the your integer.
#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