You're given the length of three sides a, b, and c respectively. Now If these three sides can form an Equilateral Triangle then print 1, if these three sides can form an Isosceles Triangle then print 2, if these three sides can form a Scalene Triangle then print 3, otherwise print −1.
#include <iostream>
using namespace std;
int main()
{
int a, b, c;
cin >> a >> b >> c;
if ((a == b && b == c) && ((a + b > c) && (b + c > a) && (c + a > b)))
{
cout << "1" << endl;
}
else if (((a == b && b != c) || (a != b && b == c) || (a == c && c != b)) && ((a + b > c) && (b + c > a) && (c + a > b)))
{
cout << "2";
}
else if ((a != b && b != c) && ((a + b > c) && (b + c > a) && (c + a > b)))
{
cout << "3" << endl;
}
else
cout << "-1" << endl;
}