title: Why isn't my code accepted as correct for "Sum of Factors" in SPOJ
body: <p>Please check <a href="http://www.spoj.com/problems/CZ_PROB2/" rel="nofollow">this question</a>("Sum of Factors") and <a href="http://www.spoj.com/problems/DIVSUM/" rel="nofollow">similar question</a>("Divisor Summation")</p>
  
  <p>My below code is accepted as correct answer for "Divisor Summation" problem but getting "wrong answer" status for "Sum of Factors" problem.</p>
  
  <p>The commented return statement is used for "Divisor Summation" problem.</p>
  
  <p>Could someone identify what could be the possible mistake? Am I missing some testcase? Please help.</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  double getFactorSum(long num){
      double factorsSum = 0;
      long i;
      for (i = 1; i &lt;= (num / i); i++ ){
          if ((num % i) == 0){
              factorsSum += ((num / i) == i ? 0 : (num / i)) + i;
          }
      }
      //return factorsSum - num;
      return factorsSum;
  }
  
  int main() {
      // your code goes here
      int numTestCases;
      cin &gt;&gt; numTestCases;
  
      while (numTestCases--){
          long input;
          cin &gt;&gt; input;
          cout &lt;&lt; getFactorSum(input) &lt;&lt; endl;
      }
  
      return 0;
  }
  </code></pre>