Pages

Search This Blog

Summation Using Function 3


Module Module2
    Sub Main()
        Dim result As Integer
        Dim x, y As Integer
        Console.Write("Enter value1:")
        x = CInt(Console.ReadLine)
        Console.Write("Enter value2:")
        y = CInt(Console.ReadLine)
        result = sum2values(x, y) 'calling the function with 2 parameters
        Console.WriteLine("Result=" & result)
        Console.ReadLine()
    End Sub
    'defining a function with 2 parameters
    Function sum2values(ByVal x, ByVal y)
        sum2values = x + y
    End Function
End Module

No comments:

Post a Comment