Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. Function calculate() As Integer
  2. Dim message As String, message2 As String
  3. Dim n1 As Byte
  4. Dim n2 As Byte
  5. Dim maximum As Integer
  6.  
  7. maximum = 100
  8.  
  9. message = "Please Enter a number 1:"
  10. message2 = "You have given bad input. Shame on you."
  11.  
  12. n1 = InputBox(message)
  13. If n1 > maximum Then
  14. MsgBox (message2)
  15. Else
  16. n2 = InputBox(message)
  17. If n2 > maximum Then
  18. MsgBox (message2)
  19. Else
  20. solution = n1 + n2
  21. MsgBox ("" & solution & " = " & n1 & " + " & n2 & ".")
  22. End If
  23. End If
  24.  
  25. End Function
  26.  
  27. Sub test()
  28. Dim result As Integer
  29.  
  30. result = calculate()
  31.  
  32. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement