Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- int main()
- {
- double x = 3.0, y1, y, sum=0;
- cout << "***********************************************************************" << endl;
- cout << "y = ";
- for (int n = 1; n < 21; n++){
- y = 2 * 1/((2*n+1)*pow(x,(2*n+1)));
- sum += y;
- if (n < 20)
- {
- cout << y << " + ";
- }
- else if (n == 20)
- {
- cout << y << " = ";
- }
- }
- cout << sum << endl;
- cout << "***********************************************************************" << endl;
- y1 = log((x+1)/(x-1));
- cout << "x = " << x << " y = " << sum << " y1 = " << y1 << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement