Write a C Program to check triangle is a equilateral, isosceles or scalene

By | 02.11.2016

Check triangle is equilateral, isosceles or scalene


Write a C Program to check triangle is a equilateral, isosceles or scalene. Here’s simple Program to check triangle is a equilateral, isosceles or scalene in C Programming Language.


A triangle is : :

  • A triangle is equilateral triangle, If it’s sides are equal.
  • A triangle is isosceles triangle, If any two sides of a triangle are equal.
  • A triangle is scalene triangle, If none of the sides are equal.

Below is the source code for C Program to check triangle is a equilateral, isosceles or scalene which is successfully compiled and run on Windows System to produce desired output as shown below :


SOURCE CODE : :


/*  C Program to check triangle is a equilateral, isosceles or scalene  */

#include<stdio.h>
#include<conio.h>

int main()
{
  int x,y,z;
  printf("Enter the sides of a triangle(x,y,z):: \n");
  scanf("%d %d %d",&x,&y,&z);
  if((x==y) && (y==z))
  {
  printf("\nThe triangle is equilateral.");
  }
  else if((x==z) || (y==z) || (x==y))
  {
  printf("\nThe triangle is isoseles.");
  }
  else
  {
  printf("\nThe triangle is scalene.");
  }
return 0;
}

OUTPUT : :


/*  C Program to check a triangle is a equilateral, isosceles or scalene  */

-------------------------FIRST RUN---------------------

Enter the sides of a triangle(x,y,z)::
4
5
6

The triangle is scalene.

--------------------------SECOND RUN--------------------

Enter the sides of a triangle(x,y,z)::
2
2
2

The triangle is equilateral.

----------------------THIRD RUN------------------------

Enter the sides of a triangle(x,y,z)::
4
4
6

The triangle is isoseles.

Above is the source code for C Program to check triangle is a equilateral, isosceles or scalene which is successfully compiled and run on Windows System.The Output of the program is shown above .

If you found any error or any queries related to the above program or any questions or reviews , you wanna to ask from us ,you may Contact Us through our contact Page or you can also comment below in the comment section.We will try our best to reach up to you in short interval.


Thanks for reading the post….

0 0 votes
Article Rating
Category: Basic Programs C Programming Tags:

About Tunde A

My name is Tunde Ajetomobi, a Tech Enthusiast and Growth Hacker. I enjoy creating helpful content that solves problem across different topics. Codezclub is my way of helping young aspiring programmers and students to hone their skills and find solutions on fundamental programming languages.

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments