Sum of two numbers


Module Module1

Sub Main()
Dim number1 As Integer
Dim number2 As Integer
Dim sum As Integer

'declaration above can also be defined in a single line instead of three lines as
'Dim number1, number2,sum as Integer
'We can separate them by comma as they share the common data-type

Console.WriteLine("Enter the first number")
number1 = Console.ReadLine

Console.WriteLine("Enter the second number")
number2 = Console.ReadLine

sum = number1 + number2
Console.WriteLine("The sum of the two numbers is " & sum)

Console.ReadKey()
End Sub

End Module

Comments

Popular posts from this blog

Program to extract vowel from the input string

Program to generate prime numbers

Program to check the input number is palindrome or not