Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int fact(int i) {
- if (i > 1) return i * fact(i - 1);
- else return 1;
- }
- int main() {
- double e = 0.0001;
- int n; cout << " Your Variant is "; cin >> n;
- double ex1 = 2.716 + 2.043 * n;
- double ex2 = 4.834 + 0.028 * n;
- double y = 1; double F = 0;
- for (int i = 0; fabs(y) >= e; i++) {
- y = pow(ex1, i) / fact(i);
- F += y;
- cout << "\n " << i << " " << ex1 << " " << y << " " << F;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement