#include<iostream>
#include<algorithm>
using namespace std;
I try to run this program to check the number is Pythagorean triples or not but this code doesn't work out. What I did wrong with this code?
bool check( int x, int y, int z){
int a = max(x , max(y,z));
I try to run this program to check the number is Pythagorean triples or not but this code doesn't work out. What I did wrong with this code?
int b;
int c;
if(a==x){
b==y;
c==z;
}
else if(a==y){
b==x;
c==z;
} else{
b==x;
c==y;
}
if(a*a == b*b + c*c){
return true;
}
else{
return false;
}
}
int32_t main(){
int x,y,z;
cin>>x>>y>>z;
if (check(x,y,z)){
cout<<"Pythagorean Triplet";
} else{
cout<<"Not a pythagorean Triplet";
}
return 0;
}
I try to run this program to check the number is Pythagorean triples or not but this code doesn't work out. What I did wrong with this code?
Aucun commentaire:
Enregistrer un commentaire