C Program to Check Triangle is Equilateral Isosceles or Scalene

Write a C Program to Check Triangle is Equilateral Isosceles or Scalene with example. For example, a, b, and c are sides.

  • Equilateral: If all sides are equal, then it is an Equilateral triangle. a= b = c
  • Isosceles: If any of the two sides are equal, it is an Isosceles Triangle. a= b or a= c or b = c
  • Scalene: If none of the sides are equal, it is a Scalene Triangle. a != b != c

C Program to Check Triangle is Equilateral Isosceles or Scalene Example

This program helps the user to enter all sides of a triangle. And then Program find whether it is an Equilateral, Isosceles, or Scalene Triangle using Else If.

/* C Program to Check Triangle is Equilateral Isosceles or Scalene */

#include<stdio.h>
 
int main()
{
	int side1, side2, side3;
 
  	printf("\n Please Enter Three Sides of a Triangle : ");
  	scanf("%d%d%d", &side1, &side2, &side3);
  	
  	if(side1 == side2 && side2 == side3)
  	{
  		printf("\n This is an Equilateral Triangle");
 	}
 	else if(side1 == side2 || side2 == side3 || side1 == side3)
 	{
 		printf("\n This is an Isosceles Triangle");
	}
	else
	{
		printf("\n This is a Scalene Triangle");
	}  
 	return 0;
 }
C Program to Check Triangle is Equilateral Isosceles or Scalene 1

Let me try another value

 Please Enter Three Sides of a Triangle : 60 40 60

 This is an Isosceles Triangle

another one

 Please Enter Three Sides of a Triangle : 60 50 40

 This is a Scalene Triangle

About Suresh

Suresh is the founder of TutorialGateway and a freelance software developer. He specialized in Designing and Developing Windows and Web applications. The experience he gained in Programming and BI integration, and reporting tools translates into this blog. You can find him on Facebook or Twitter.