語法 if 條件式 then else end if |
Exercise 1 ¢寫一個判斷是否及格的程式,如果成績大於等於60分,就印出”Pass”,沒有就印出”Fail”
Ans input "please insert your grade: ";grade if grade < 60 then print "fail" else print "pass" end if |
Exercise 2 寫出一個倍數判斷的程式,輸入兩個正整數 A、B,如果 A 是 B 的倍數,則印出 "Yes",否則印出 "No“ Ans input " please insert two integers: ";a,b if a mod b =0 then print "yes !!" else if print "NO!!" end if |