Advertisement
Riaz_Islam

fib_brute

May 24th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.18 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int f(int n)
  5. {
  6.     if (n < 2) return 1;
  7.     return f(n-1) + f(n-2);
  8. }
  9.  
  10. int main() {
  11.  
  12.     cout<<f(10)<<endl;
  13.  
  14.     return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement