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 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 .
A triangle is : :
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 : :
OUTPUT : :
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 .
need an explanation for this answer? contact us directly to get an explanation for this answer