Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- setlocale(LC_CTYPE, "Russian");
- double x, a = 8, b = 12, S, h, S1, S2, L1, L2;
- int i, n=200;
- h = (b - a) / (2 * n);
- x = a + 2 * h;
- S1 = 0;
- S2 = 0;
- for (i = 1; i < n; i++)
- {
- S2 += 2 - pow(x, 2) + x;
- x += h;
- S1 += 2 - pow(x, 2) + x;
- x += h;
- }
- L1 = 2 - pow(a, 2) + a;
- L2 = 2 - pow(b, 2) + b;
- S = h*(L1 + 4 * (L1 + h) + 4 * S1 + 2 * S2 + L2) / 3;
- cout << "S = " << S << "\n";
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement