Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- using namespace std;
- int main()
- {
- long double q,n,z=1;
- cin>>n;
- q=n;
- z=(z+n/z)/2;
- for (int i=0;i<20;i++)
- {z=(z+q/z)/2;}
- cout<<fixed<<setprecision(6)<<z<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement