Advertisement
tiskowdaknife

Untitled

Oct 22nd, 2023
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. Dim num1 As Double
  2. Dim num2 As Double
  3. Dim op As String
  4.  
  5. Console.Write("Enter the first number: ")
  6. num1 = Console.ReadLine()
  7.  
  8. Console.Write("Enter an operator (+, -, *, /, ^): ")
  9. op = Console.ReadLine()
  10.  
  11. Console.Write("Enter the second number: ")
  12. num2 = Console.ReadLine()
  13.  
  14. Select Case op
  15. Case "+"
  16. Console.WriteLine("The result is: " & (num1 + num2))
  17. Case "-"
  18. Console.WriteLine("The result is: " & (num1 - num2))
  19. Case "*"
  20. Console.WriteLine("The result is: " & (num1 * num2))
  21. Case "/"
  22. If num2 <> 0 Then
  23. Console.WriteLine("The result is: " & (num1 / num2))
  24. Else
  25. Console.WriteLine("Error! Division by zero is not allowed.")
  26. End If
  27. Case "^"
  28. Console.WriteLine("The result is: " & (num1 ^ num2))
  29. Case Else
  30. Console.WriteLine("Invalid operator.")
  31. End Select
  32.  
  33. Console.ReadLine()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement