C++ Program to Check Type of Triangle
Write C++ Program to Check Type of Triangle
// CPP Program to Check Type of Triangle #include <iostream> using namespace std; int main() { int side1, side2, side3; cout << "Enter Length of Side 1 :--> "; cin >> side1; cout << "Enter Length of Side 2 :--> "; cin >> side2; cout << "Enter Length of Side 3 :--> "; cin >> side3; if(side1 == side2 && side2 == side3) cout << "Given Triangle is Equilateral"; else if(side1 == side2 || side2 == side3 || side3 == side1) cout << "Given Triangle is Isosceles"; else cout << "Given Triangle is Scalene"; return 0; }
Output:
Run - 1:
Enter Length of Side 1 :--> 5
Enter Length of Side 2 :--> 5
Enter Length of Side 3 :--> 5
Given Triangle is Equilateral
Run - 2:
Enter Length of Side 1 :--> 10
Enter Length of Side 2 :--> 5
Enter Length of Side 3 :--> 10
Given Triangle is Isosceles
Run - 3:
Enter Length of Side 1 :--> 5
Enter Length of Side 2 :--> 6
Enter Length of Side 3 :--> 7
Given Triangle is Scalene