C Program to find Area of Triangle using Base and Height

C Program to find Area of Triangle using Base and Height

Write C Program to find the Area of the Triangle using Base and Height

//Write a C program to find the area of Triangle using Base and Height

#include <stdio.h>

int main()
{
    float area, height, base;

    printf("Enter Height of Triangle :--> ");
    scanf("%f", &height);

    printf("Enter Base of Triangle :--> ");
    scanf("%f", &base);

    area =  (height * base)/2.0;   // area of triangle formula

    printf("Area of triangle having height %0.2f and base %0.2f is :--> %0.2f\n",height,base, area);

    return 0;
}

Output:

Enter Height of Triangle :--> 4
Enter Base of Triangle :--> 7

Area of triangle having height 4.00 and base 7.00 is :--> 14.00