Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- void nierek(unsigned int);
- int main()
- {
- unsigned int n, i;
- printf("Podaj n: ");
- scanf("%u", &n);
- nierek(n);
- }
- void nierek(unsigned int n)
- {
- double l1, l2, x1, x2;
- l1 = (1+sqrt(5))/2;
- l2 = (1-sqrt(5))/2;
- x1 = pow(l1, n);
- x2 = pow(l2, n);
- printf("%lf", (x1-x2)/sqrt(5));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement