Tuesday 8 August 2017

code for area of triangle

#include"stdio.h"
#include"conio.h"
#include"math.h"
float leg1,leg2,area,hypo;
void main()
{
    printf("Enter the values of Leg1 and Leg2\n");
    scanf("%f%f",&leg1,&leg2);
    if((leg1>0)&&(leg2>0))
    {
        area=0.5*leg1*leg2;
        hypo=sqrt(leg1*leg1+leg2*leg2);
        printf("Area :%f \n Hypotenuse :%f",area,hypo);
    }
    else
        printf("Invalid Input");
    getch();
}

0 comments: