- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Find the altitude and area of an isosceles triangle in C++n

Consider we have the side of the isosceles triangle, our task is to find the area of it and the altitude. In this type of triangle, two sides are equal. Suppose the sides of the triangle are 2, 2 and 3, then altitude is 1.32 and the area is 1.98.

Altitude(h)=$$\sqrt{a^{2}-\frac{b^{2}}{2}}$$

Area(A)=$\frac{1}{2}*b*h$

## Example

#include<iostream> #include<cmath> using namespace std; float getAltitude(float a, float b) { return sqrt(pow(a, 2) - (pow(b, 2) / 4)); } float getArea(float b, float h) { return (1 * b * h) / 2; } int main() { float a = 2, b = 3; cout << "Altitude: " << getAltitude(a, b) << ", Area: " << getArea(b, getAltitude(a, b)); }

## Output

Altitude: 1.32288, Area: 1.98431

- Related Articles
- Find the altitude and area of an isosceles triangle in C++
- The length of the hypotenuse of an isosceles right-angled triangle is ( 20 . ) Find the perimeter and area of the triangle.
- The length of the hypotenuse of an isosceles right-angled triangle is 24. Find the area of the triangle.
- Verify by drawing a diagram if the median and altitude of an isosceles triangle can be same.
- Construct an isosceles triangle whose base is ( 8 mathrm{~cm} ) and altitude ( 4 mathrm{~cm} ) and then another triangle whose sides are ( 3 / 2 ) times the corresponding sides of the isosceles triangle.
- Construct an isosceles triangle whose base is 8 cm and altitude 4 cm and then another triangle whose sides are $1frac{1}{2}$ times the corresponding sides of the isosceles triangle.
- In an isosceles triangle $ABC$, if $AB = AC = 13 cm$ and the altitude from $A$ on $BC$ is $5 cm$, find $BC$."
- An isosceles triangle has perimeter ( 30 mathrm{~cm} ) and each of the equal sides is ( 12 mathrm{~cm} ). Find the area of the triangle.
- In ( triangle mathrm{ABC}, mathrm{AB}=mathrm{AC} ) and ( mathrm{AM} ) is an altitude. If ( A M=15 ) and the perimeter of ( triangle A B C ) is 50 , find the area of ( triangle mathrm{ABC} ).
- Find the altitude of an equilateral triangle of side ( 8 mathrm{~cm} ).
- Find the length of altitude of an equilateral triangle of side $8 cm$.
- In an isosceles triangle ABC, AB $=$ AC $=$ 25 cm, BC $=$ 14 cm. Calculate the altitude from A on BC."
- $AD$ is an altitude of an equilateral triangle $ABC$. On $AD$ as base, another equilateral triangle $ADE$ is constructed. Prove that Area($triangle ADE$):Area($triangle ABC$)$=3:4$.
- The perimeter of an isosceles triangle is $42 cm$ and its base is ($frac{3}{2}) times each of the equal sides. Find the length of each side of the triangle, area of the triangle and the height of the triangle.
- The vertices of $triangle ABC$ are $(-2, 1), (5, 4)$ and $(2, -3)$ respectively. Find the area of the triangle and the length of the altitude through $A$.
- What is an Isosceles triangle?

Advertisements