C++ code on finding the hypotenuse | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

C++ code on finding the hypotenuse

5th Oct 2017, 5:51 PM
Eric Gikera
Eric Gikera - avatar
2 Answers
+ 10
#include <iostream> #include <cmath> int main() { int b, h; std::cin >> b >> h; std::cout << "Hypotenuse: " << sqrt((b*b)+(h*h)); return 0; }
5th Oct 2017, 6:47 PM
Hatsy Rei
Hatsy Rei - avatar
+ 7
do you want this...... 👇👇👇👇👇👇👇 #include <iostream. h> #include <math. h> void main () { int base, height, hyposquare ,hypo; cout <<"enter base and height of triangle "; cin>>base>>height; hyposquare =pow(base,2)+pow(height,2); hypo=sqrt(hyposquare); cout<<"hypotenuse of triangle is "<<hypo; getch(); }
5th Oct 2017, 6:09 PM
Swati Tiwari