213k views
4 votes
Write a program that accepts the lengths of three sides of a triangle as inputs.

The program output should indicate whether or not the triangle is an equilateral triangle.
Use The triangle is equilateral. and The triangle is not equilateral. as your final outputs.
An example of the program inputs and output is shown below:
Enter the first side: 2
Enter the second side: 2
Enter the third side: 2
The triangle is equilateral.

User Forzaa
by
7.9k points

1 Answer

2 votes

Step-by-step explanation:

#include <iostream>

using namespace std;

int main()

{

int side1, side2, side3;

cout << "Enter the first side: ";

cin >> side1;

cout << "Enter the second side: ";

cin >> side2;

cout << "Enter the third side: ";

cin >> side3;

if (side1 == side2 && side2 == side3)

cout << "The triangle is equilateral." << endl;

else

cout << "The triangle is not equilateral." << endl;

return 0;

}

User Gibran Shah
by
8.0k points