trojanxem

Untitled

Nov 7th, 2012
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.25 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. unsigned long int fib(int x)
  4. {
  5.     if ( x < 2 )
  6. {
  7. return x;
  8. }
  9. else
  10.     return fib(x-1)+fib(x-2);
  11. }
  12.  
  13. int main()
  14. {
  15. unsigned long int a = 0;
  16. printf("Podaj liczbe :\n");
  17. scanf("%ld", &a);
  18. printf("%ld", fib(a));
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment