Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions RightTriangleChecker.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <bits/stdc++.h>
using namespace std;

bool checkRight(int a, int b, int c){
if(a*a + b*b == c*c)
return true;
return false;
}

int main(){
int a,b,c;

cout<<"Enter 1st number"<<endl;
cin>>a;
cout<<"Enter 2nd number"<<endl;
cin>>b;
cout<<"Enter 3rd number"<<endl;
cin>>c;

if(checkRight(a,b,c)||checkRight(b,c,a)||checkRight(c,a,b))
cout<<"Yes, it is a right triangle"<<endl;
else
cout<<"No, it is not a right triangle"<<endl;

return 0;
}