Advertisement
Artcik

lab 10.3

Dec 18th, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. void nierek(unsigned int);
  5.  
  6. int main()
  7. {
  8. unsigned int n, i;
  9. printf("Podaj n: ");
  10. scanf("%u", &n);
  11. nierek(n);
  12.  
  13. }
  14. void nierek(unsigned int n)
  15. {
  16. double l1, l2, x1, x2;
  17.  
  18. l1 = (1+sqrt(5))/2;
  19. l2 = (1-sqrt(5))/2;
  20. x1 = pow(l1, n);
  21. x2 = pow(l2, n);
  22. printf("%lf", (x1-x2)/sqrt(5));
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement