Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- bool isPythagorean(int a, int b, int c)
- {
- return (a*a + b*b == c*c);
- }
- int main()
- {
- int limit;
- cout << "Введите верхний предел: ";
- cin >> limit;
- int count = 0;
- for (int a = 1; a <= limit; a++)
- {
- for (int b = a; b <= limit; b++)
- {
- for (int c = b; c <= limit; c++)
- {
- if (isPythagorean(a, b, c))
- {
- count++;
- cout << count << ") " << a << "," << b << "," << c << "\n";
- }
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement