Commit b0a79544 authored by Michael's avatar Michael

michael.davityan:exercise_05_20v4

parent ffd088f9
......@@ -4,17 +4,17 @@ int
main()
{
for (int hypotenuse = 5; hypotenuse <= 500; ++hypotenuse) {
int variable = 2;
int firstValue = 2;
for (int catheter1 = hypotenuse - 1; catheter1 > 0; --catheter1) {
if (catheter1 + variable < hypotenuse) {
if (catheter1 + firstValue < hypotenuse) {
break;
}
for (int catheter2 = variable; catheter2 <= catheter1; ++catheter2) {
for (int catheter2 = firstValue; catheter2 < catheter1; ++catheter2) {
if (hypotenuse * hypotenuse == catheter1 * catheter1 + catheter2 * catheter2) {
std::cout << hypotenuse << ", " << catheter1 << ", " << catheter2 << std::endl;
}
}
++variable;
++firstValue;
}
}
return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment