Using Enumeration type
Sample Run 1:
Enter the measurement of the sides of the triangle: 3 4 5
The triangle is an example of scalene triangle.
Sample Run 2:
Enter the measurement of the sides of the triangle: 10 10 8
The triangle is an example of isosceles triangle.
Sample Run 3:
Enter the measurement of the sides of the triangle: 10 10 10
The triangle is an example of equilateral triangle.
Sample Run 4:
Enter the measurement of the sides of the triangle: 10 1 2
The triangle is an example of notriangle triangle.
#include<iostream>
using namespace std;
int main()
{
int x, y, z;
cout << "\nEnter the measurement of the sides of the Triangle :\n ";
cin >> x>> y >> z;
if(x == y && z == z)
{
cout << "\nThis is an Equilateral Triangle";
}
else if(x == y || y == z || x == z)
{
cout << "\nThis is an Isosceles Triangle";
}
else if(x || y || z ==1)
{
cout << "\nThis is an Notriangle Triangle";
}
else
cout << "\nThis is a Scalene Triangle";
return 0;
}
Comments
Leave a comment