Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim num1 As Double
- Dim num2 As Double
- Dim op As String
- Console.Write("Enter the first number: ")
- num1 = Console.ReadLine()
- Console.Write("Enter an operator (+, -, *, /, ^): ")
- op = Console.ReadLine()
- Console.Write("Enter the second number: ")
- num2 = Console.ReadLine()
- Select Case op
- Case "+"
- Console.WriteLine("The result is: " & (num1 + num2))
- Case "-"
- Console.WriteLine("The result is: " & (num1 - num2))
- Case "*"
- Console.WriteLine("The result is: " & (num1 * num2))
- Case "/"
- If num2 <> 0 Then
- Console.WriteLine("The result is: " & (num1 / num2))
- Else
- Console.WriteLine("Error! Division by zero is not allowed.")
- End If
- Case "^"
- Console.WriteLine("The result is: " & (num1 ^ num2))
- Case Else
- Console.WriteLine("Invalid operator.")
- End Select
- Console.ReadLine()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement