Search⌘ K

Example 13: Determine the Type of a Triangle

Explore how to create a C program that takes three sides of a triangle and determines its type, including scalene, isosceles, equilateral, or right-angled. Understand how to validate triangle sides and apply decision making to classify each shape accurately.

We'll cover the following...

Problem

Write a program that takes three sides of a triangle as input, and checks whether the triangle is isosceles, equilateral, scalene, or right-angled.

The output should be printed on the console in the following manner:

  • Scalene triangle
  • Isosceles triangle
...