Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication 2.5.cpp: определяет точку входа для консольного приложения.
- //
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- void Iter(double x, double &sum, int n)
- {
- sum = 1;
- double pow = 1;
- for (int i = 1; i <= n; i++)
- {
- pow *= x;
- sum += (18 - 2 * i)*pow;
- }
- }
- int main()
- {
- int n;
- double x0 = 0, xm = 3, dx = 0.25, sum, b, x;
- cout << "enter ur n\n";
- cin >> n;
- x = x0;
- while (x < xm)
- {
- Iter(x, sum, n);
- x += dx;
- }
- cout << "result = "<<sum<<"\n";
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement