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 196 views
196 views asked Aug 15, 2021 by avibootz
2 answers 182 views
2 answers 179 views
2 answers 173 views
2 answers 171 views
171 views asked Aug 14, 2021 by avibootz
2 answers 153 views
2 answers 151 views
...