VB.net Program to Create a Sub-Routine to Add Two Integer Numbers

You are currently viewing VB.net Program to Create a Sub-Routine to Add Two Integer Numbers

VB.Net program to create a sub-routine to add two integer numbers

'VB.Net program to create a sub-routine to 
'add two integer numbers.

Module Module1
    Sub AddNum(ByVal num1 As Integer, ByVal num2 As Integer)
        Dim num3 As Integer = 0

        num3 = num1 + num2
        Console.WriteLine("Addition is: {0}", num3)
    End Sub

    Sub Main()
        Dim num1 As Integer = 0
        Dim num2 As Integer = 0

        Console.WriteLine("Enter number1: ")
        num1 = Integer.Parse(Console.ReadLine())

        Console.WriteLine("Enter number2: ")
        num2 = Integer.Parse(Console.ReadLine())

        AddNum(num1, num2)
    End Sub
    
End Module
Enter number1:
10
Enter number2:
20
Addition is: 30
Press any key to continue . . .

Ranjith Kumar

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply