Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- int a, b, c, d;
- cin >> a >> b >> c >> d;
- bool solucio_trobada = false;
- for (int i = a; i <= b and not solucio_trobada ; ++i) {
- for (int j = c; j <= d and not solucio_trobada; ++j) {
- double n = sqrt(i*i + j*j);
- int num = int(n);
- if (n == double(num)) {
- cout << i << "^2 + " << j << "^2 = "
- << num << "^2" << endl;
- solucio_trobada = true;
- }
- }
- }
- if (not solucio_trobada) {
- cout << "No solution!" << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement