Write a program that prompts the user for the two legs of a

Write a program that prompts the user for the two legs of a right triangle and

makes use of the pow and sqrt functions and the Pythagorean theorem to

compute the length of the hypotenuse.

Solution

#include <iostream>
#include <math.h>
using namespace std;


int main() {
   // your code goes here
float height,base;
  
cout << \"Enter height of right triangle : \";
cin >> height;
  
cout << \"Enter base of right triangle : \";
cin >> base;
  
float hypotenuese = sqrt(pow(height,2)+pow(base,2));
  
cout << \"H is : \" << hypotenuese;
   return 0;
}

Write a program that prompts the user for the two legs of a right triangle and makes use of the pow and sqrt functions and the Pythagorean theorem to compute th

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site