title: Determining if square root is an integer
body: <p>In my program, I am trying to take the find the largest prime factor of the number 600851475143. I have made one for loop that determines all the factors of that number and stores them in a vector array. The problem I am having is that I don't know how to determine if the factor can be square rooted and give a whole number rather than a decimal. My code so far is: </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  #include &lt;math.h&gt;
  
  using namespace std;
  vector &lt;int&gt; factors;
  
  int main()
  {
      double num = 600851475143;
      for (int i=1; i&lt;=num; i++)
      {
          if (fmod(num,i)==0)
          {
              factors.push_back(i);
          }
      }
  
       for (int i=0; i&lt;factors.size(); i++)
       {
           if (sqrt(factor[i]))                      // ??? 
       }
  }
  </code></pre>
  
  <p>Can someone show me how to determine whether a number can be square rooted or not through my if statement? </p>