Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- float function(float x,float e)
- {float s,a; float n; s=0; n=2; a=1;
- while(fabs(a)>=e)
- {s+=a;
- a*=pow(-1,n)*((x*(1+n-2)*(4+n-2))/((2+n-2)*(5+n-2)));
- n++;}
- cout<<" "<<x<<" "<<s<<" "<<n-2<<endl;
- return 0;
- }
- float main()
- { int n,i;
- float e,s;
- setlocale(LC_ALL, "Russian");
- cout<<"№ "<<"Значение X "<<"Значение функции F(x) "<<"Количество просуммированных слагаемых n "<<endl;
- cin>>e;
- i=1;
- for(float x=0.1;x<=1;x+=0.1)
- {cout<<i<<"\t";
- function(x,e);
- i++;}
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement