Write a C++ program which will prompt as input the value of two sides of a right triangle and then determine the size of the hypotenuse. [Hint: Hypotenuse = square root of (a^2+b^2 ), where a, b are the two sides of a right triangle.]
#include <iostream> #include <cmath> using namespace std; int main(){ float a, b, c; cout<<"Enter size of first side of right triangle: "; cin>>a; cout<<"Enter size of second side of right triangle: "; cin>>b; c = sqrt(a*a+b*b); cout<<"Size of the hypotenuse = "<<c<<endl; return 0; }
Get Answers For Free
Most questions answered within 1 hours.