You are on page 1of 2

/*assignment1= Write a C program to accept the length of three sides of triangle

and to test and print the type of triangle as equilateral, isosceles, right angled or
none.
Author= Ayesha Kazi
Roll No= 554
Batch= E3
*/
#include <stdio.h>
main()
{
float a,b,c,l1,l2,l3,h1,h2,h3 ;
printf ("\n enter the 3 sides of a triangle") ;
scanf ("%f %f %f" , &a,&b,&c) ;
l1= a*a;
l2=b*b;
l3=c*c;
h1=l2+l3;
h2=l1+l3;
h3=l1+l2;
if (a==b && a==c)
{
printf("\n the triangle is equilateral") ;
}
else if (a==b || b==c || c==a)
{
printf("\n the triangle is isosceles");
}
else if (l1==h1 || l2==h2 || l3==h3)
{

printf(" \n triangle is right angled");


}
else
{
printf("\n None of these");
}
/* 5 5 5

enter the 3 sides of a triangle


the triangle is equilateral

122

enter the 3 sides of a triangle


the triangle is isosceles

123

enter the 3 sides of a triangle


none of these

345

enter the 3 sides of a triangle


triangle is right angled
*/

You might also like