Public Class ParamArithmeticOperation
Private Shared Sub Main()
'calling function
PerformArithmeticOperation(200, 100, "+")
'perform addition
PerformArithmeticOperation(200, 100, "-")
'perform subtraction
PerformArithmeticOperation(200, 100, "*")
'perform multiplication
PerformArithmeticOperation(200, 100, "/")
'perform division
End Sub
'called function
Public Shared Sub PerformArithmeticOperation(ParamArray items As Object())
Dim result = 0
Select Case Convert.ToString(items(2))
'items[2] is the operator(s) i.e. +,-,*,/
Case "+"C
result = Convert.ToInt32(items(0)) + Convert.ToInt32(items(1))
Exit Select
Case "-"C
result = Convert.ToInt32(items(0)) - Convert.ToInt32(items(1))
Exit Select
Case "*"C
result = Convert.ToInt32(items(0)) * Convert.ToInt32(items(1))
Exit Select
Case "/"C
result = Convert.ToInt32(items(0)) / Convert.ToInt32(items(1))
Exit Select
Case Else
Console.WriteLine("No such operation available")
End Select
Console.WriteLine(result)
End Sub
End Class