Why does the answer print out twice?
<p>I made a program that returns the product a*b*c where a,b,c are pythagorean triples and add up to 1000. The program does output the correct answer but does it twice. I was curious as to why this is so.  After playing around with it a bit I found out that it prints out when a = 200 b = 375 c = 425. And once again when a = 375 b = 200 c = 425.</p>

<pre><code>bool isPythagTriple(int a, int b, int c);

int main()
{

    for(int a = 1; a &lt; 1000; a++)
    {
        for(int b = 1; b &lt; 1000; b++)
        {
            for(int c = 1; c &lt; 1000; c++)
            {
                if( ((a+b+c)==1000) &amp;&amp; isPythagTriple(a,b,c) )
                {
                    cout &lt;&lt; a*b*c &lt;&lt; " ";
                    break;
                }
            }
        }
    }

    return 0;
}

bool isPythagTriple(int a, int b, int c)
{
    if( (a*a)+(b*b)-(c*c) == 0 )
        return true;
    else
        return false;
}
</code></pre>
