Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int ft_fibonacci(int nb)
- {
- if (nb < 0)
- {
- return (-1);
- }
- if (nb == 0)
- {
- return (0);
- }
- if (nb == 1)
- {
- return (1);
- }
- if (nb == 2)
- {
- return (1);
- }
- return (ft_fibonacci(nb - 2) + ft_fibonacci(nb - 1));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement