פתרון לתרגילים - IF - ELSE - THEN :
תרגיל - 1
option explicit

dim a,reminder
num = cint(input("Enter Number"))


if num mod 10 = 5 or num mod 10 = 0  then
   msgbox "divided by 5" 

else
   msgbox "Not divided by 5"
end if

תרגיל - 2

option explicit

dim name,salary,button

name = inputbox("Enter Name")

button = msgbox(name & " ,do you agree to enter your salary?",vbyesno)

if button = vbyes then
salary=cint(inputbux(name & ", please enter your salary"))
if salary < 5000 then
msgbox "You Deserve A Raise"
else
msgbox "You Don't Deserve A Raise"
end if
else
msgbox "Go Home"
end if

תרגיל - 3
option explicit

dim name,salary,raise

name = inputbox("Enter Name")

salary = cint(intputbox(name & ", please enter your salary))

raise = cint(inputbox(name & ", please enter a raise percent))

if salary + (salary*raise/100) <= 10000 then
salary = salary + (salary*raise/100)
end if

msgbox "Your new salary is " & salary

תרגיל -4
דרך פתרון ראשונה :
Calculator  
option explicit
dim num1,num2,action


num1=cint(inputbox("Enter First Number"))
num2=cint(inputbox("Enter Second Number"))

operat=inputbox("Select an option calculation" & vbcr & "(+, -, /, * )")

if
action = "+" then
msgbox "The Option was '+' " & vbcr & "The Result Is " & num1+num2
end if

if
action = "-" then
msgbox "The Option was '-' " & vbcr & "The Result Is " & num1-num2
end if

if
action = "*" then
msgbox "The Option was '*' " & vbcr & "The Result Is " & num1*num2
end if

if
action = "/" then
msgbox "The Option was '-' " & vbcr & "The Result Is " & num1/num2
end if


דרך פתרון שניה :
option explicit
dim num1,num2,action

if action = "+" then
   msgbox "The Option was '+' " & vbcr & "The Result Is " & num1+num2
elseif  
action = "-" then
   msgbox "The Option was '-' " & vbcr & "The Result Is " & num1-num2
elseif
action = "*" then
   msgbox "The Option was '*' " & vbcr & "The Result Is " & num1*num2
elseif
action = "/" then
   msgbox "The Option was '-' " & vbcr & "The Result Is " & num1/num2
end if


תרגיל - 5
rem Personal Info
option explicit

dim name,age,button,phone

name=inputbox("Enter Your Name","Personal Information")

button = msgbox("" &name &" Will You Enter Your Age?",vbyesno+vbinformation,"Personal Information")

if button = vbyes then
age=inputbox("Enter Your Age","Personal Information")
end if

if age < 1 or age >120 then
age = 0
end if

phone=inputbox("Type in Your Phone Number","Personal Information")

msgbox "Your Personal Information :" & vbcr & "Your Name - " &name & vbcr & "Your Age - " &age & vbcr & "Your Phone - " &phone,vbinformation,"Personal Information"

,תרגיל - 6

rem USER/PASS
option explicit

dim user,pass
dim vpass,button

user=inputbox("Enter User Name")
pass=inputbox("Enter Your Password")

vpass=inputbox("Enter your Password For Validation")

if pass=vpass then
msgbox "Valid Closing Up",vbinformation,"Validation Check"
else if pass<>vpass then
button=msgbox("Select Cancel To Close Or Try Again",vbretrycancel+vbinformation,"Validation Check")
end if
end if

if button = vbcancel then
msgbox "Closing Up",vbinformation,"Validation Check"
else if button = vbretry then
vpass=inputbox("Enter your Password Again")
end if
end if

if pass=vpass then
msgbox "Valid Closing Up",vbinformation,"Validation Check"
else if pass<>vpass then
msgbox "Closing Up",vbinformation,"Validation Check"
end if
end if


תרגיל - 7

rem USER/PASS
option explicit

dim user,pass
dim vpass,button

user=inputbox("Enter User Name")
pass=inputbox("Enter Your Password")

vpass=inputbox("Enter your Password For Validation")

if pass=vpass then
msgbox "Valid Closing Up",vbinformation,"Validation Check"
else if pass<>vpass then
button=msgbox("Select Cancel To Close Or Try Again",vbretrycancel+vbinformation,"Validation Check")
end if
end if

if button = vbcancel then
msgbox "Closing Up",vbinformation,"Validation Check"
else if button = vbretry then
vpass=inputbox("Enter your Password Again")
end if
end if

if pass=vpass then
msgbox "Valid Closing Up",vbinformation,"Validation Check"
else if pass<>vpass then
msgbox "Closing Up",vbinformation,"Validation Check"
end if
end if