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,valor1,valor2;
- double sol;
- bool fin = false;
- cin >> a >> b>> c>> d;
- valor1 = a, valor2 = c;
- while(((a<=valor1) && (valor1 <= b)) && (fin == false)){
- valor2 = c;
- while((c<=valor2) && (valor2<=d) && (fin == false)){
- sol = (valor1*valor1)+(valor2*valor2);
- if(sqrt(sol)-int(sqrt(sol)) == 0){
- fin = true;
- }
- if(fin == false){
- ++valor2;
- }
- }
- if(fin == false){
- ++valor1;
- }
- }
- if(fin == false){
- cout << "Sense solucio!"<< endl;
- }
- else{
- cout << valor1 << "^2 + " << valor2 << "^2 = " << sqrt(sol) << "^2" << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement