pythagorean triplet code example

Example 1: pythagorean triplet

#include<bits/stdc++.h>
using namespace std;

bool check(int a,int b,int c){
    int y,z;
    int x = max(a,max(b,c));
    if(x == a)
    {
        y=b;
        z=c;

    }
    if(x == b)
    {
        y=a;
        z=c;
    }
    if(x == c)
    {
        y=a;
        z=b;
    }
    if((x*x)==(y*y) + (z*z)){
        return 1;
    }
    else{
        return 0;
    }
}

int32_t main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(check(a,b,c)){
        cout<<"Pythagoras triplet";
    }
    else{
        cout<<"Not a Triplet";
    }
    return 0;
}

Example 2: pythagorean triplet

#include<bits/stdc++.h>
using namespace std;

bool check(int a,int b,int c){
    int y,z;
    int x = max(a,max(b,c));
    if(x == a)
    {
        y=b;
        z=c;

    }
    if(x == b)
    {
        y=a;
        z=c;
    }
    if(x == c)
    {
        y=a;
        z=b;
    }
    if((x*x)==(y*y) + (z*z)){
        return 1;
    }
    else{
        return 0;
    }
}

int32_t main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(check(a,b,c)){
        cout<<"Pythagoras triplet";
    }
    else{
        cout<<"Not a Triplet";
    }
    return 0;
}