C Program to check whether the triangle is Equilateral, Scalene or isosceles using the if-else ladder
/* C Program to check
whether the triangle is Equilateral, Scalene or isosceles using the if-else ladder. */
#include<stdio.h>
#include<conio.h>
void
main()
{
int a,b,c;
clrscr();
printf("Enter three sides of the triangle:
");
scanf("%d%d%d",&a,&b,&c);
if(a==b&& b==c) //If all sides are equal
{
printf("Equilateral triangle.");
}
else if(a==b || a==c || b==c) //If two
sides are equal
{
printf("Isosceles triangle.");
}
else //If none sides are
equal
{
printf("Scalene triangle.");
}
getch();
}
===============================
OUTPUT:-
Enter
three sides of the triangle: 60 60 60
Equilateral
triangle.
Comments
Post a Comment