Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <math.h>
- #include <conio.h>
- using namespace std;
- //int factorial(int k);
- int main()
- {
- double a, b, h, x, r, s;
- int n, zn = -1, k;
- setlocale(LC_ALL, "Russian");
- cout << "Введите a,b,h,n" << endl;
- cin >> a >> b >> h >> n;
- for (x = a; x <= b; x += h);
- {
- r = s = 1;
- for (k = 1; k <= n; k++);
- {
- r = zn*r*(pow((2 * x),2.) / (2 * k));
- s += r;
- }
- cout << x << " " << s;
- }
- _getch();
- return 0;
- }
- /* int factorial(int k)
- {
- if (k > 1)
- return k * factorial(k - 1);
- else
- return 1;
- } */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement