How to compute the hypotenuse h of the triangle in VB.NET

1 Answer

0 votes
Imports System

Class HypotenuseCalculator
    Public Shared Sub Main()
        Dim a As Double = 7
        Dim b As Double = 5
		
        Dim h1 As Double = Math.Sqrt(Math.Pow(a, 2) + Math.Pow(b, 2))
        Console.WriteLine($"The hypotenuse (h) is: {h1}")
        
		Dim h2 As Double = Math.Sqrt(a * a + b * b)
        Console.WriteLine($"The hypotenuse (h) is: {h2}")
    End Sub
End Class


  
' run:
' 
' The hypotenuse (h) is: 8.602325267042627
' The hypotenuse (h) is: 8.602325267042627
'

 



answered Jun 28, 2025 by avibootz
...