Advertisement
Aslai

Untitled

Sep 25th, 2011
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.27 KB | None | 0 0
  1. a(n){n=n<2?n:a(--n)+a(--n);}
  2. main(int n){int i;for(i=0;i<20;i++)printf("%i - %i\n",i, a(i));}
  3.  
  4. outputs
  5.  
  6. 0 - 0
  7. 1 - 1
  8. 2 - 1
  9. 3 - 2
  10. 4 - 3
  11. 5 - 5
  12. 6 - 8
  13. 7 - 13
  14. 8 - 21
  15. 9 - 34
  16. 10 - 55
  17. 11 - 89
  18. 12 - 144
  19. 13 - 233
  20. 14 - 377
  21. 15 - 610
  22. 16 - 987
  23. 17 - 1597
  24. 18 - 2584
  25. 19 - 4181
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement