include //needed for cin and cout #include //needed for using the exp function using namespace std;
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
include //needed for cin and cout #include //needed for using the exp function using namespace std;
statement below) // Test your solution for different values of x and N: The approximation should converge to the exact value as N becomes large cout <<endl<< "The approximate value of e'x using " << N+1« terms of the power series is: « approx<<endl; cout << "The exact value of e'x is: " << exp(x) << endl; //here we used the exp function from the math.h library to get the exact value of ex return; }
include <iostream> //needed for cin and cout #include <math.h> //needed for using the exp function using namespace std; long long int factorial(int ) { if (k -- ) return 1; > return factorial(k. 1) K3 } e int main() { cout << "Please enter x: double x; cin >> X; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 cout << "Please enter N: "; int N; cin >> N; // Write here the code to compute the approximate ex using 1+1 terms of the power series. // Store the result in a variable called "approx" (used in the cout