Guest User

Untitled

a guest
Jun 16th, 2013
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. int fib(int n) =
  2. if n < 2 then n
  3. else fib(n-1) + fib(n-2)
  4.  
  5. int ifib(int n) =
  6. if n < 2 then n else do
  7. int current = 1;
  8. int previous = 1;
  9. while n > 2 do
  10. int sum = current + previous;
  11. previous = current;
  12. current = sum;
  13. n = n-1;
  14. done;
  15. current;
  16. done
  17.  
  18.  
  19. void main() = do
  20. print ifib(100000*12.3*'a');
  21. done
Advertisement
Add Comment
Please, Sign In to add comment