Advertisement
vitormartinotti

Untitled

May 14th, 2024
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.21 KB | None | 0 0
  1. //Fatorial
  2. int fat(int n){
  3.     if(n == 1) return 1;
  4.     return n * fat(n-1);
  5. }
  6. //Fibonacci
  7. int fibo(int n){
  8.     printf("fibo(%d)\n", n);
  9.     if(n == 1 || n == 2) return 1;
  10.     return fibo(n-1) + fibo(n-2);
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement