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