Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double Root(double E, double x0){
- double xp, xn = x0;
- do{
- xp = xn;
- xn = cos(xp);
- } while (fabs(xn-xp) >= E);
- return xn;
- }
- int main(){
- double eps = 1e-6, x0 = 1.0;
- double r = Root(eps, x0);
- cout<<r<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement