Watching Sky

Triangle

  • C
  • BASIC
C

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
    float a,b,c,s,hero,area;
    clrscr();
    printf("enter the sides of triangle\n");
    scanf("%f%f%f",&a,&b,&c);
    if(a+b>c&&b+c>a&&c+a>b)
    {
    printf("triangle is possible\nthe triangle is ");
    if(a*a+b*b==c*c||b*b+c*c==a*a||c*c+a*a==b*b)
    printf("right angled ");
    if(a==b&&b==c&&c==a)
    printf("equilateral\n");
    else if(a==b||b==c||c==a)
    printf("isosceles\n");
    else
    printf("scalene\n");
    s=(a+b+c)/2;
  hero=s*(s-a)*(s-b)*(s-c);



    area="sqrt(hero);




    printf("area of the triangle is %5.2f",area);
    }
    else
    printf("triangle is not possible");
    getch();

}

BASIC