Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- double calculateU(int);
- int main()
- {
- int n;
- double u;
- printf("Enter n: ");
- scanf("%d", &n);
- u = calculateU(n);
- printf("U(%d) = %f\n", n, u);
- return 0;
- }
- double calculateU(int n)
- {
- int i;
- double u = 1;
- for (i = 1; i <= n; i++)
- {
- u = 2 * sqrt(u + 1) - 1;
- }
- return u;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement