Ruby program to find the hypotenuse of a right-angled triangle with sides l and b

bookmark


print "Enter side L: ";
l = gets.chomp.to_i;  

print "Enter side B: ";
b = gets.chomp.to_i;  

result = Math.hypot(l, b);
print "Result: ",result;

 


Output:

Enter side L: 23
Enter side B: 24
Result: 33.24154027718932