Advertisement
MAT4m

Untitled

Jan 13th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int RecFun(int n)
  5. {
  6.  
  7.  
  8. if(n==0)
  9. return 0;
  10. if(n==1)
  11.  
  12. return 1;
  13.  
  14. else
  15.  
  16. return (RecFun(n-2)+RecFun(n-1));
  17.  
  18. }
  19. int main(int n)
  20. {
  21. int wynik;
  22.  
  23. printf("podaj n\n");
  24. scanf("%d",&n);
  25. wynik = RecFun(n);
  26. printf("wynik: %d",wynik);
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement