Solving hackerrank " Summing the N series" challenge
<p>I have come up with a code for the "Summing the N series" challenge from hackerrank.com. Here is a link to the problem:  <a href="https://www.hackerrank.com/challenges/summing-the-n-series" rel="nofollow">https://www.hackerrank.com/challenges/summing-the-n-series</a>.</p>

<p>However, my "solution" does not seem to work for big numbers, and I have no idea why.</p>

<pre><code>#include &lt;iomanip&gt;
#include &lt;cmath&gt;
#include &lt;iostream&gt;

using namespace std;

int main(){
    cout &lt;&lt; fixed;
    int t;
    double input, sum, temp=pow(10,9) + 7, result;

    cin &gt;&gt; t;

    for (int o = 0; o &lt; t; o++) {
        cin &gt;&gt; input;
        sum = input*input;
        result = fmod(sum, temp);
        cout &lt;&lt; setprecision(0) &lt;&lt; result &lt;&lt; endl;
    }
    return 0;
}   
</code></pre>