0

Hey, guys.

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

For example, 3² + 4² = 9 + 16 = 25 = 5².

There exists exactly one Pythagorean triplet for which a + b + c = 1000.

Find the product abc.

```
#include <iostream>
using namespace std;
int a = 0; int b = 0; int c = 0;
bool Found = false;
int Find_Triplet(int,int,int);
int Find_Triplet(int a, int b, int c)
{
for (int i = 5; i < 1000; i++)
{
c = i;
for (int j = 2; j < c; j++)
{
b = j;
for (int k = 1; k < b; k++)
{
a = k;
if (a*a + b*b == c*c && a+b+c == 1000)
{
Found = true;
break;
}
}
if (Found)
break;
}
if (Found)
break;
}
return a*b*c;
}
int main()
{
cout << Find_Triplet(a,b,c) << endl;
return 0;
}
```

How can I improve my program?

Thank you.

Petcheco

*Edited 1 Year Ago by Petcheco*