CJCoding With Joseph

Hypotenuse Function

Write a function double hypotenuse(double a, double b) that returns the hypotenuse length using sqrt(a*a + b*b). Call it with hypotenuse(3, 4) and print the result with exactly 2 decimal places:

5.00

Include <cmath> for sqrt.

Expected Output:

5.00
Topics:
Functions
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (cout, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.