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 Area of Triangle using Base and Height

// CPP Program to Find Area of Triangle using Base and Height

#include <iostream>

using namespace std;

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

    cout << "Enter Height of Triangle :--> ";
    cin >> height;

    cout << "Enter Base of Triangle :--> ";
    cin >> base;

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

    cout << "Area of triangle having height " << height << " and base " << base << " is :--> " << 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