fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. long int fib(int n) {
  6. int a=1;
  7. int b=1;
  8. for (int i=3; i<=n; i++) {
  9. int pom=a;
  10. a=b;
  11. b=pom+b;
  12. }
  13. return b;
  14. }
  15. int main() {
  16. cout<<fib(4)<<" , "<<fib(11)<<endl;
  17. cout<<endl;
  18. return 0;
  19. }
Success #stdin #stdout 0.01s 5324KB
stdin
Standard input is empty
stdout
3  ,  89