VB.NET Program to add two integers

Problem

Write a program in VB.NET to add two integers and display the result on the screen.

VB.NET Program to add two integers

Module ACModule
    Sub Main()
        Dim input1, input2, result As Integer

        Console.Write(" Enter the first number : ")
        input1 = Convert.ToInt32(Console.ReadLine())
        Console.Write(" Enter the second number : ")
        input2 = Convert.ToInt32(Console.ReadLine())
        result = input1 + input2
        Console.Write(Environment.NewLine & " The sum of two numbers is:" & result)
        Console.ReadLine()
    End Sub

End Module

Output

Enter the first number : 1

Enter the second number : 2

The sum of two numbers is:3

Leave Your Comment

Liked this content?. Please spread the word :)