VB.NET PROGRAM TO ADD TWO NUMBERS / INTEGERS
In this post, we will see a VB.Net Program to read two number inputs from user and display the sum.
The program below accepts two numbers from user and perform basic arithmetic operation(addition) using +
operator and display the sum on screen.
For algorithm & flowchart to add two numbers, go through the post given below.
Program :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
Module Module1 Sub Main() Dim num1, num2, sum As Integer Console.WriteLine(">>> VB>NET Console program to add two integers <<<") Console.Write(" Enter the first number to be added: ") num1 = Convert.ToInt32(Console.ReadLine()) Console.Write(" Enter the second number to be added: ") num2 = Convert.ToInt32(Console.ReadLine()) sum = num1 + num2 Console.Write(Environment.NewLine & " The sum of two numbers is:" & sum) Console.ReadLine() End Sub End Module |
Sample Output :