Advertisement
askarulytarlan

Числа Фибоначчи

Sep 21st, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <cmath>
  4. #include <math.h>
  5. int F(int n) {
  6. if (n < 2){
  7. return 1;
  8. }
  9. else {
  10. return F(n - 1) + F(n - 2);
  11. }
  12. }
  13. int main() {
  14. for(int i=0;i<=16;i++){
  15. std::cout<<F(i)<<std::endl;;
  16.  
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement