

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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++
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 Questions & Answers
- Find the area and perimeter of right triangle in PL/SQL
- Java program to find the area of a triangle
- Area of Reuleaux Triangle?
- Program to calculate the Area and Perimeter of Incircle of an Equilateral Triangle What is Equilateral Triangle in C?
- Program to calculate area of Circumcircle of an Equilateral Triangle
- Area of circle which is inscribed in an equilateral triangle?
- Program to calculate area and perimeter of equilateral triangle
- C++ program to find the Area of the Largest Triangle inscribed in a Hexagon?
- Program to find the highest altitude of a point in Python
- Program to calculate area of Circumcircle of an Equilateral Triangle in C++
- Largest Triangle Area in Python
- Find the Number of Possible Pairs of Hypotenuse and Area to Form Right Angled Triangle using C++
- Golang Program to Find the Area of a Triangle Given All Three Sides
- C Program to check whether the triangle is equilateral, isosceles or scalene
- Program to calculate area and perimeter of equilateral triangle in C++
Advertisements