Imports System
Public Module Module1
Public Function FahrenheitToCelsius(ByVal f As Double) As Double
Dim t As Double
t = (f - 32) * (5.0 / 9.0)
Return t
End Function
Public Sub Main()
Dim temp_f As Double, temp_c As Double
Try
Console.Write("Enter Temperature in Fahrenheit: ")
temp_f = Convert.ToDouble(Console.ReadLine())
temp_c = FahrenheitToCelsius(temp_f)
Console.WriteLine("{0:F2} Fahrenheit = {1:F2} celsius", temp_f, temp_c)
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
End Sub
End Module
' run 1:
'
' Enter Temperature in Fahrenheit: 1
' 1.00 Fahrenheit = -17.22 celsius
'
' run 2:
'
' Enter Temperature in Fahrenheit: 50
' 50.00 Fahrenheit = 10.00 celsius
'