Conversion Learn programming Visual Basic (VB.net)

Lesson:

First contact with Visual Basic (VB.net)


Exercise:

Conversion


Objetive:

Create a Visual Basic (VB.net) program to convert Celsius degrees to Kelvin and Fahrenheit. The program will prompt the user to input the temperature in Celsius degrees, and then use the following conversion formulas:

Kelvin = Celsius + 273
Fahrenheit = Celsius x 1.8 + 32

The program will then display the equivalent temperature in both Kelvin and Fahrenheit units.


Code:

Imports System
Public Class exercise14
    Private Shared Sub Main()
        Console.Write("Enter the amount of celsius: ")
        Dim celsius As Integer = Convert.ToInt32(Console.ReadLine())
        Console.WriteLine("Kelvin = {0}", celsius + 273)
        Console.WriteLine("Fahrenheit = {0}", celsius * 18 / 10 + 32)
    End Sub
End Class

Juan A. Ripoll - Systems Tutorials and Programming Courses ©  All rights reserved.  Legal Conditions.