Pythagorean triplet

NEED C PROGRAM FOR THE FOLL QUESTION:

A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,
a2 + b2 = c2

For example, 32 + 42 = 9 + 16 = 25 = 52.

There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.
We don't do other people's homeworks. If you have a specific question, ask away, but don't ask for the whole thing.
Some teacher assigned a problem like this one? It's more maths than C I think.

If you want my advice replace c by the value the other variables produce (((int)(sqrt(a*a+b*b)+0.5)) and run a double loop for the other variables (a,b) until your condition is met (a+b+c=1000).

In other words compare a+b+ (int)(sqrt(a*a+b*b)+0.5) with 1000 until you find the numbers.

Limits for your loops up to 333 is satisfactory I guess (since a+b+c=1000).

This is a problem from the Eulerproject: http://projecteuler.net/

I do some of the challenges on there, they are very good, but the site encourages you not to discuss the problems online and work them out yourself.
Topic archived. No new replies allowed.