Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include "iostream"
- #include "iomanip"
- #include "math.h"
- using namespace std;
- int main()
- {
- double a,b,h,x,y,p;
- int n,i;
- cout <<"Enter a,b,n:"<< endl;
- cin>>a>>b>>n;
- h=(b-a)/10;
- x=a;
- do
- {
- p=x;
- for (i=1;i<=n;i++);
- {
- p*=(-1)*pow(x,2)/((i+1)*(i+2));
- p=x+p;
- }
- y=sin(x);
- cout<<setw(15)<<p<<setw(15)<<y<<setw(15)<<endl;
- x+=h;
- }
- while (x<=b);
- cout<<endl;
- system("pause");
- return 0;
- }
Add Comment
Please, Sign In to add comment