129k views
1 vote
Write a program to enter three sides of a triangle and check whether the triangle is possible or not. If possible, then display whether it is an equilateral, isosceles, or scalene triangle; otherwise, display a message that the triangle is not possible.

1 Answer

2 votes

Final answer:

To write a program to enter three sides of a triangle and check its possibility, you can use pseudocode with if-else statements to determine whether the triangle is equilateral, isosceles, or scalene.

Step-by-step explanation:

Pseudocode:

1. Take input of the three sides of the triangle: side1, side2, side3

2. Check if the sum of any two sides is greater than the third side.

3. If the above condition is true, check for the type of triangle:

  • a. If side1 = side2 = side3, it is an equilateral triangle.
  • b. If side1 = side2 or side1 = side3 or side2 = side3, it is an isosceles triangle.
  • c. If none of the sides are equal, it is a scalene triangle.

4. If the condition in step 2 is false, display a message that the triangle is not possible.

Learn more about triangle types

User Rafis Ganeev
by
8.5k points

No related questions found