Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <cmath>
- using namespace std;
- const double eps = 1e-6;
- signed main()
- {
- double a,b,h;
- a = 0, b = 3, h = 0.3;
- for (double x = a; x<=b; x+=h)
- {
- double sign = 1;
- double chisl = 1;
- double znam = 1;
- double i = 1;
- double sum= 0;
- double cnt = 0;
- do
- {
- cnt = sign*chisl/znam;
- sum+=cnt;
- znam *=i*i;
- i++;
- chisl*=x*x/4;
- sign *=-1;
- }
- while (fabs(cnt)>=eps);
- cout << fixed << setprecision(6) << x<< " "<< sum << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement