VB.Net Program to ADD two INTEGERS without using THIRD VARIABLE
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
Module Module1 Sub Main() Dim x As Integer, y As Integer Console.WriteLine("*** www.ProgrammingPosts.blogspot.com ***") Console.WriteLine(">>> VB.NET PROGRAM TO ADD TWO NUMBERS WITHOUT USING THIRD VARIABLE <<< ") 'vblf gets the cursor to next linein console Console.Write(vbLf & " Enter the first number to be added: ") ' taking x value from keyboard x = Convert.ToInt32(Console.ReadLine()) Console.Write(vbLf & " Enter the second number to be added: ") ' taking y value from keyboard y = Convert.ToInt32(Console.ReadLine()) 'assining the value of sum of x and y to x x = x + y 'printing the sum. Console.WriteLine(vbLf & " The sum of two numbers is: " & x) Console.ReadLine() End Sub End Module |
Sample Output: