Find the altitude and area of an isosceles triangle | CPP program to find the Altitude Area of an isosceles triangle ; function to find the altitude ; return altitude ; function to find the area ; return area ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; float altitude ( float a , float b ) { return sqrt ( pow ( a , 2 ) - ( pow ( b , 2 ) / 4 ) ) ; } float area ( float b , float h ) { return ( 1 * b * h ) / 2 ; } int main ( ) { float a = 2 , b = 3 ; float h = altitude ( a , b ) ; cout << setprecision ( 3 ) ; cout << " Altitude = ▁ " << h << " , ▁ " ; cout << " Area = ▁ " << area ( b , h ) ; return 0 ; }