Advertisement
Felanpro

Amateur square root source code

Aug 27th, 2017
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. double number_input;
  2.  
  3.     cout << "Insert the number that you want to get the square root of: ";
  4.     cin >> number_input;
  5.  
  6.     double result = 0;
  7.     bool flag = true;
  8.     double iterator_;
  9.  
  10.     while(flag == true)
  11.     {
  12.         iterator_++;
  13.         result = iterator_ * iterator_;
  14.  
  15.         if(result == number_input)
  16.         {
  17.             break;
  18.         }
  19.     }
  20.  
  21.     cout<< iterator_;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement