cout << "Enter the length of side a: "; cin >> a; cout << "Enter the length of side b: "; cin >> b; cout << "Enter the length of side c: "; cin >> c; // Calculate the semi-perimeter of the triangle p = (a + b + c) / 2; // Calculate the height of the triangle height = (2 * sqrt(p * (p - a) * (p - b) * (p - c))) / a; cout << "The height of the triangle dropped on side a is: " << height << endl; return 0;
using namespace std;
int main() {
cout << "Enter the length of side a: ";double a, b, c, p, height;
cin >> a;
cout << "Enter the length of side b: ";
cin >> b;
cout << "Enter the length of side c: ";
cin >> c;
// Calculate the semi-perimeter of the triangle
p = (a + b + c) / 2;
// Calculate the height of the triangle
height = (2 * sqrt(p * (p - a) * (p - b) * (p - c))) / a;
cout << "The height of the triangle dropped on side a is: " << height << endl;
return 0;
}