题目
代码
cpp
#include <bits/stdc++.h>
using namespace std;
int main()
{
int side1, side2, hypotenuse;
for (side1 = 1; side1 <= 500; side1++)
{
for (side2 = side1; side2 <= 500; side2++)
{
for (hypotenuse = 1; hypotenuse <= 500; hypotenuse++)
{
if (side1 * side1 + side2 * side2 == hypotenuse * hypotenuse)
cout << "直角边是:" << side1 << " " << side2 << " 斜边是:" << hypotenuse << endl;
}
}
}
return 0;
}