Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2020
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. int fact(int i) {
  5.     if (i > 1) return i * fact(i - 1);
  6.     else return 1;
  7. }
  8. int main() {
  9.     double e = 0.0001;
  10.     int n; cout << " Your Variant is "; cin >> n;
  11.     double ex1 = 2.716 + 2.043 * n;
  12.     double ex2 = 4.834 + 0.028 * n;
  13.     double y = 1; double F = 0;
  14.     for (int i = 0; fabs(y) >= e; i++) {
  15.         y = pow(ex1, i) / fact(i);
  16.         F += y;
  17.         cout << "\n " << i << "  " << ex1 << "   " << y << "  " << F;
  18.     }
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement