Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- #include <cmath>
- using namespace std;
- int Factorial(int i) {
- int sum = 0;
- for (int x = 1; x <= i; x++)
- sum += i;
- return sum;
- }
- double Element(int i, int x) {
- return pow(x, i) / Factorial(i);
- }
- int main()
- {
- setlocale(LC_ALL, "rus");
- int n, x;
- double sum = 0;
- cout << "x = "; cin >> x;
- cout << "N = "; cin >> n;
- for (int i = 1; i <= n; i++)
- sum += Element(x, i);
- cout << "Сумма ряда до " << n << " члена равна " << sum << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement