/*Program to check whether the triangle is equilateral, isosceles or scalene. *Also prints the area of the triangle * Author: rahule@cse.iit.ac.in * * Created on 13 August, 2010, 11:46 PM */ #include #include int main() { double a,b,c,s,area; //variable declaration printf("\nEnter the edges of the triangle :"); scanf("%lf%lf%lf",&a,&b,&c); if((a+b)<=c||(a+c)<=b||(b+c)<=a) //checking whether the triangle is valid or not printf("\nThe edges doesnt corresponds to a real traingle"); else { if(a==b&&b==c) //condition for equilateral printf("\nThe triangle is equilateral"); else if(a==b||a==c||b==c) //condition for isosceles printf("\nThe triangle is isosceles"); else printf("\nThe triangle is scalene"); ////condition for scalene s=(a+b+c)/2; //finding S area=sqrt(s*(s-a)*(s-b)*(s-c)); //finding the area of a traingle using the formula area=sqrt(s*(s-a)*(s-b)*(s-c)) printf("\nThe area of triangle is %lf",area); //outputting the area } }