click on this link......

LinkGrand.com
Showing posts with label program to check whether triangle is equilateral. Show all posts
Showing posts with label program to check whether triangle is equilateral. Show all posts

Tuesday, 10 September 2013

Program to check whether triangle is equilateral, isosceles or scalene triangle

If the three sides of a triangle are entered through the keyboard, write a program to check whether triangle is equilateral, isosceles or scalene triangle.
#include<stdio.h>
#include<conio.h>
void main()
{
int s1,s2,s3;
clrscr();
printf("Enter three sides of a traingle");
scanf("%d%d%d",&s1,&s2,&s3);
if(s1==s2 && s2==s3 && s1==s3)
{
printf("\n Equilateral triangle");
}
else if(s1==s2 || s2==s3 || s1==s3)
{
printf("\n Isosceles triangle");
}
else
{
printf("\n Scalene traingle");
}
getch();
 }


Output1:

Enter three sides of a triangle: 25 25 25

Equilateral triangle

Output2:

Enter three sides of a triangle: 25 25 45

Isosceles triangle

Output3:

Enter three sides of a triangle: 25 35 56

Scalene triangle