Write a C program to check whether a triangle is equilateral, scalene or isosceles triangle using if else. Program to enter sides of a triangle and classify triangle as Equilateral, Scalene or Isosceles triangle using if else in C. How to check whether a triangle is equilateral, scalene or isosceles triangle in C programming.

Input first side: 30

Input second side: 30

Input third side: 30

Output: Equilateral triangle

A triangle is

A triangle is

Read more about properties of triangle.

Happy coding ;)

**Example:**Input first side: 30

Input second side: 30

Input third side: 30

Output: Equilateral triangle

### Required knowledge

Basic programming, If else#### Properties of triangle

A triangle is**Equilateral Triangle**if all its sides are equal.A triangle is

**Isosceles Triangle**if its two sides are equal.A triangle is

**Scalene Triangle**if none of its sides are equal.Read more about properties of triangle.

### Program to check equilateral, scalene or isosceles triangle

/** * C program to check whether a triangle is Equilateral, Isosceles or Scalene */ #include <stdio.h> int main() { int a, b, c; //a, b, c are three sides of a triangle /* Reads all sides of a triangle */ printf("Enter three sides of triangle: "); scanf("%d%d%d", &a, &b, &c); if(a==b && b==c) { //If all sides are equal printf("Equilateral triangle.\n"); } else if(a==b || a==c || b==c) { //If two sides are equal printf("Isosceles triangle.\n"); } else { //If none sides are equal printf("Scalene triangle.\n"); } return 0; }

Output

Enter three sides of triangle: 30

30

30

Equilateral triangle.

30

30

Equilateral triangle.

Happy coding ;)

### You may also like

- If else programming exercises index.
- C program to check whether a triangle is valid or not if all angles are given.
- C program to check whether a triangle is valid or not if sides are given.
- C program to find angle of a triangle if two angles are given.
- C program to find area of a triangle.
- C program to find the area of an Equilateral triangle.
- C program to find power of a number.
- C program to enter any character and check whether it is alphabet or not.
- C program to enter any number and check whether it is divisible by 5 and 11 or not.
- C program to enter any number and check whether it is negative, positive or zero.
- C program to check whether a year is leap year or not.

< code >< pre > -- Your source code -- < /pre >< /code > (Remove spaces from pre and code tags).