1. Write a script to print the greatest of three integers.
Look at the script below.
Var1 = CINT(Inputbox("Enter value for Var1: "))
Var2 = CINT(Inputbox("Enter value for Var2: "))
Var3 = CINT(Inputbox("Enter value for Var3: "))
if Var1=Var2 and Var1=Var3 then
aaaamsgbox"All the values are same: "&Var1
elseif Var1=Var2 and Var1>Var3 then
aaaamsgbox"Var1 & Var2 i.e. " &Var1& " is greater than "&Var3
elseif Var1=Var3 and Var1>Var2 then
aaaamsgbox"Var1 & Var3 i.e. " &Var1& " is greater than "&Var2
elseif Var2=Var3 and Var2>Var1 then
aaaamsgbox "Var2 & Var3 i.e. " &Var2& " is greater than "&Var1
elseif Var1>Var2 and Var1>Var3 then
aaaamsgbox "Var1 i.e. "&Var1& " is greater than "&Var2& ", "&Var3
elseif Var2>Var1 and Var2>Var3 then
aaaamsgbox "Var2 i.e. "&Var2& " is greater than "&Var1& ", "&Var3
else
aaaamsgbox "Var3 i.e. "&Var3& " is greater than "&Var1& ", "&Var2
end if
In the above script we are joining the values and some meaning ful string to the message and this is done using the '&' which is to join the strings.
2. Write a script to print the least of the three integers.
For this please think and write. you have to only make some small change.
No comments:
Post a Comment