Advertisement
Guest User

sqrt fun

a guest
Jun 23rd, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int SquareRoot(int number)
  4. {
  5.     int check,square;
  6.     int half =number/2;
  7. bool cond =1;
  8. int i=2;
  9.   while (i<half&&cond)
  10.   {
  11.  
  12.       check =number/i;
  13.     if (check==i)
  14.        {square=check;
  15.            cond=0;
  16.  
  17.        }
  18.        i++;
  19.   }
  20. int main()
  21. {
  22.  
  23. SquareRoot(141);
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement