Advertisement
rengetsu

Proced_2_Pratyb_2.07

Mar 2nd, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.23 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4. int main()
  5. {
  6.     long double  q,n,z=1;
  7.     cin>>n;
  8.     q=n;
  9.     z=(z+n/z)/2;
  10.     for (int i=0;i<20;i++)
  11.     {z=(z+q/z)/2;}
  12.     cout<<fixed<<setprecision(6)<<z<<endl;
  13.     return 0;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement