C++ Program to Check Triangle is Equilateral Isosceles or Scalene

Write a C++ Program to Check Triangle is Equilateral Isosceles or Scalene with an example. If all three sides of a triangle are equal, it is an equilateral triangle. Else if any of the two sides are equal, it is an isosceles triangle. Otherwise, it is a scalene triangle.

#include<iostream>
using namespace std;

int main()
{
	int side1, side2, side3;
	
	cout << "\nPlease Enter Three Sides of a Triangle =  ";
	cin >> side1 >> side2 >> side3;
	
	if(side1 == side2 && side2 == side3)
  	{
  		cout << "\nThis is an Equilateral Triangle";
  	}
  	else if(side1 == side2 || side2 == side3 || side1 == side3)
    {
  		cout << "\nThis is an Isosceles Triangle";
	}
  	else
    	cout << "\nThis is a Scalene Triangle";
		
 	return 0;
}
C++ Program to Check Triangle is Equilateral Isosceles or Scalene

In this C++ output, all three sides are different. So, it is a scalene triangle.

Please Enter Three Sides of a Triangle =  30 60 90

This is a Scalene Triangle

side1 = 30, side2 = 30, side3 = 120. It means, two sides are equal so isosceles triangle.

Please Enter Three Sides of a Triangle =  30 30 120

This is an Isosceles Triangle