Pages

Search This Blog

Summation Using Function 1


Module SumUsingFunction

    Sub Main()
        Dim i, j, s As Integer
        Console.Write("Enter 1st Number: ")
        i = CInt(Console.ReadLine())
        Console.Write("Enter 2nd Number: ")
        j = CInt(Console.ReadLine())
        s = sum(i, j)
        Console.WriteLine("Sum of " + i.ToString() + " + " + j.ToString() + " = " + s.ToString())
        Console.ReadLine()
    End Sub
    Function sum(ByVal a As Integer, ByVal b As Integer) As Integer
        sum = a + b
    End Function


End Module

No comments:

Post a Comment