cacodemon665

Лаба 3 Вариант 8

Oct 2nd, 2018
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include "pch.h" //для версий вижлы старше последних версий 2017 здесь должно быть #include "stdafx.h"
  2. #include <iostream>
  3. #include <math.h>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     double a = 0.1, b = 1;
  10.     int n = 100;
  11.  
  12.     double step = (b - a) / 10;
  13.  
  14.     cout << "Y(x)         S(x)" << endl;
  15.  
  16.     for (double x = a; x <= b; x += step)
  17.     {
  18.         cout << exp(2 * x) << "  ";
  19.         double sum = 1, a = 1, b = 1;
  20.  
  21.         for (int i = 1; i < n; i++)
  22.         {
  23.             a *= 2 * x;
  24.             b *= i;
  25.  
  26.             sum += a / b;
  27.         }
  28.  
  29.         cout << sum << endl;
  30.     }
  31.  
  32.     return 0;
  33. }
Add Comment
Please, Sign In to add comment