How to find area of isosceles triangle in C++

2 Answers

0 votes
#include <iostream>
#include <cmath>

int main(void) {
    double a = 5; // length of two equal sides
    double base = 8;
 
    double area = (1 / 2.0) * base * sqrt((a * a) - ((base * base) / 4));
 
    std::cout << "Area of Isosceles Triangle = " << area;
}
 
 
 
 
 
/*
run:
 
Area of Isosceles Triangle = 12
 
*/

 



answered Aug 15, 2021 by avibootz
0 votes
#include <iostream>

int main(void) {
    double h = 3;
    double base = 8;
 
    double area = (1 / 2.0) * base * h;
 
    std::cout << "Area of Isosceles Triangle = " << area;
}
 
 
 
 
 
/*
run:
 
Area of Isosceles Triangle = 12
 
*/

 



answered Aug 15, 2021 by avibootz

Related questions

2 answers 212 views
212 views asked Aug 15, 2021 by avibootz
2 answers 206 views
2 answers 197 views
2 answers 191 views
2 answers 191 views
191 views asked Aug 14, 2021 by avibootz
2 answers 167 views
2 answers 168 views
...