Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- #include <conio.h>
- float x(int n)
- {
- if (n <= 1) return 1;
- return 0.3*x(n - 1);
- }
- float y(int n)
- {
- if (n <= 1) return 1;
- return pow(x(n - 1), 2) + y(n - 1);
- }
- int main()
- {
- int n, i;
- float sum = 0;
- printf("input n: "); scanf("%d", &n);
- for (i = 1; i <= n; i++)
- sum += x(i) / (1 + y(i));
- printf("sum=%f", sum);
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment