9 - special pythagorean triplet

A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,

special_pythagorean_triplet

For example,

special_pythagorean_triplet

There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc.

link

cevap : 31875000

#include <stdio.h>
#include <math.h>
#pragma hdrstop
#include <tchar.h>
#pragma argsused

int _tmain(int argc, _TCHAR* argv[])
{
    unsigned int a,b,c,multiplication;

    for (a = 1; a < 1000; ++a)
    {
        b = (500000-1000*a)/(1000-a);
        c = sqrt(a*a + b*b);
        if ((a+b+c) == 1000)
        {
            break;
        }
    }

    multiplication = a*b*c;

    return 0;
}