'4) write a program to read two values as user input and add them then print the value
Dim x
x = InputBox("Enter an Integer value1","Input Reader")
y = InputBox("Enter an Integer value2","Input Reader")
' the subdata types in x and y are strings as they are read from the input box
' you need to convert them to integers to add
a = CInt(x)
b = CInt(y)
' Cint() is the function used to convert a string to integer
c = a + b
WScript.Echo c
Dim x
x = InputBox("Enter an Integer value1","Input Reader")
y = InputBox("Enter an Integer value2","Input Reader")
' the subdata types in x and y are strings as they are read from the input box
' you need to convert them to integers to add
a = CInt(x)
b = CInt(y)
' Cint() is the function used to convert a string to integer
c = a + b
WScript.Echo c
No comments:
Post a Comment