MeehoweCK

Untitled

Jun 11th, 2021
667
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. unsigned int fibonacci(unsigned int n)
  6. {
  7.     if(n == 0)
  8.         return 0;
  9.     if(n == 1 || n == 2)
  10.         return 1;
  11.     return fibonacci(n - 1) + fibonacci(n - 2);
  12. }
  13.  
  14. int main()
  15. {
  16.     for(unsigned i = 1; i <= 20; ++i)
  17.         cout << fibonacci(i) << endl;
  18.     return 0;
  19. }
RAW Paste Data