Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- int main() {
- setlocale(LC_ALL, "Russian");
- int n;
- double x, x2, xP, p = 1.0;
- cout << "Введите значение n (n >= 2): ";
- cin >> n;
- cout << "Введите значение x: ";
- cin >> x;
- x2 = x * x;// x^2
- xP = x; // x^(2*n - 1)
- for (int i = 2; i <= n; i++) {
- xP *= x2;
- p *= 1 + (i % 2 == 0? 1 : -1) * xP / (pow(i, 3) - 1);
- }
- printf("P: %6.14lf", p);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement