Public Function 22 (card1 as integer, card2 as integer, _card3 as integer, card4 as integer) AS STRINGIF CARD1 <1 or Card1> 13 THEN MSGBOX "Unable to calculate!", 48 Exit Functionelseif Card2 <1 or card2> 13 THEN MSGBOX "Unable to calculate!", 48 exit functionelseif card3 <1 or card3> 13 kilobox "unable to calculate!", 48 exit functionelseif card4 <1 or card4> 13 damGBox "Unable to calculate!", 48 exit functionendiff
DIM A AS INTEGERDIM B AS INTEGERDIM C AS INTEGERDIM D AS INTEGERDIM I AS INTEGERDIM J AS INTEGERDIM N AS INTEGERDIM K AS INTEGER
A = card1b = card2c = card3d = card4
IF A B C D = 24 THEN calculation 24 = STR $ (a) " " STR $ (c) " " STR $ (d) "= 24" EXIT FUNCTIONEND IFOR i = 1 to 2 for j = 1 to 3 for n = 1 to 4 if A B C - D = 24 THEN calculation 24 = STR $ (a) " " STR $ (b) " " STR $ (c) "-" STR $ (d) "= 24" EXIT FUNCTION END IF IF A B - C - D = 24 THEN calculation 24 = Str $ (a " " STR $ (b) "-" STR $ (c) "-" STR $ (d) "= 24" EXIT FUNCTION END IF A B C * D = 24 Then calculate 24 = STR $ (a) " " STR $ ((c) "*" STR $ (d) "= 24" EXIT FUNCTION END IF ( A B C) * D = 24 THEN 22 = "(" STR $ (a) " " STR $ (b) " " STR $ (c) ") *" STR $ (d) "= 24" EXIT FUNCTION END IF IF A (B C) * D = 24 THEN calculation 24 = STR $ (a) " (" STR $ (b) " " STR $ (c) ") *" STR $ (d) "= 24" EXIT FUNCTION END IF IF A B C / D = 24 Then calculation 24 = STR $ (a) " " STR $ (b) " "
STR $ (c) "/" STR $ (d) "= 24" exit function end if IF a (b c) / d = 24 THEN calculation 24 = STR $ (a) " (" STR $ (b) " " STR $ (d) ") /" STR $ (d) "= 24" EXIT FUNCTION END IF IF (A B - C) * D = 24 THEN 24 = "(" STR $ (a) " " STR $ (c) ") *" STR $ (d) "= 24" EXIT FUNCTION END IF IF A (B - C) * D = 24 Then 22 = STR $ (a) " (" STR $ (c) " " STR $ (d) "= 24" EXIT FUNCTION END IF A B - C / D = 24 Then calculation 24 = STR $ (a) " " STR $ (b) "-" Str $ c) "/" STR $ (d) "= 24" EXIT FUNCTION END IF IF (A B) * (C D) = 24 THEN calculation 24 = "(" STR $ (a) " " STR $ (b) ") * (" STR $ (c) " " STR $ (d) ") = 24 "EXIT FUNCTION END IF A B * C - D = 24 THEN 22 = STR $ (a) " " STR $ (b) "*" STR $ (c) "-" STR $ (d) "= 24" EXIT FUNCTION END IF (A b) * c - d =
24 THEN 22 = "(" STR $ (a) " " STR $ (c) "-" STR $ (d) "= 24" EXIT FUNCTION END IF IF (A B) * (C - D) = 24 THEN calculation 24 = "(" STR $ (a) " " STR $ (b) ") * (" STR $ (c) "-" "EXIT FUNCTION END IF IF A B * C * D = 24 THEN calculation 24 = STR $ (a) " " STR $ b) "*" STR $ (c) "*" STR $ (d) "= 24" exit function end if if if if (a b) * c * d = 24 THEN count 24 = "(" STR $ (a) " " STR $ (c) "*" STR $ (d) "= 24" exit function end ififf (A B * c) * D = 24 THEN calculation 24 = "(" STR $ (a) " " STR $ (b) "*" STR $ (c) ") *" STR $ ( d) "= 24" EXIT FUNCTION END IF A B * C / D = 24 THEN calculation 24 = STR $ (a) " " STR $ (b) "*" Str $ (c) "/" STR $ (d) "= 24" exit Function End IF IF (A B) * C / D = 24 THEN Calculation 24 = "(" STR $ (a) " " STR (B) ") *" STR $ (c) " / "
STR $ (d) "= 24" exit function end if if if (a b * c) / d = 24 THEN calculation 24 = "(" STR $ (a) " STR $ (b) "*" STR $ (c) ") /" STR $ (d) "= 24" exit function end if if if if (a b / c) * D = 24 THEN calculation 24 = "(" STR $ (a) " " STR $ (b) "/" STR $ (c) ") *" STR $ (d) "= 24" EXIT FUNCTION END IF IF (A - B - c) * D = 24 THEN calculation 24 = "(" STR $ (a) " STR $ (c) ") * " STR $ (d) "= 24" EXIT FUNCTION END IF IF (A - B) * C - D = 24 THEN 22 = "(" STR $ (a) "-" STR $ (b) ") *" STR $ (c) "-" STR $ (d) "= 24" exit function end if if if (a - b) * (c - d) = 24 THEN calculation 24 = "(" Str $ (A "-" " " " STR $ (c) " " STR $ (d) ") = 24 "EXIT FUNCTION END IF IF (A - b) * C * D = 24 the N calculation 24 = "(" STR $ (a) " " STR $ (c) "*" STR $ (d) "= 24" exit Function end if IF (a - b * c) * D = 24 THEN count 24 =
"(" STR $ (a) "-" STR $ (c) ") *" STR $ (d) "= 24" exit function end ififf (A - b) * C / D = 24 THEN 22 = "(" STR $ (a) " " STR $ (c) "/" Str $ (d) "= 24" exit function end if if if (a - b / c) * d = 24 THEN calculation 24 = "(" STR $ (a) " STR $ (b) "/" / " STR $ (c) ") * " STR $ (d) " = 24 "EXIT FUNCTION END IF A * B C * D = 24 THEN calculation 24 = STR $ (a) " * " STR $ (b) " " STR $ (c) " * " STR $ (d) " = 24 "exit function end if IF a * b c / d = 24 THEN count 24 = STR $ (a) "*" STR $ (c) " STR $ (d) " = 24 "exit function end if if a * b - C - D = 24 Then 22 = STR $ (a) "*" STR $ (b) "-" STR $ (d) "= 24" EXIT Function end if if A * B - C * D = 24 Then 22 = STR $ (a) "*" STR $ (b) "-" STR $ (c) "*" STR $ (d) " = 24 "EXIT FUNCTION END IF IF (A * B - C) * D =
24 THEN 22 = "(" STR $ (a) "*" STR $ (c) ") *" STR $ (d) "= 24" EXIT FUNCTION END IF A * B - C / D = 24 Then calculation 24 = STR $ (a) "*" STR $ (b) "-" STR $ (c) "/" STR $ (d) "= 24" EXIT FUNCTION END IF IF (A * B - C) / D = 24 THEN calculation 24 = "(" STR $ (a) "*" STR $ (b) "- " STR $ (c) ") / " STR $ (d) " = 24 "EXIT FUNCTION END IF A * B * C - D = 24 THEN calculation 24 = STR $ (a) " * " STR $ (b) "*" STR $ (c) "-" STR $ (d) "= 24" EXIT FUNCTION END IF A * B * C * D = 24 THEN calculation 24 = STR $ (a) "*" STR $ (b) "*" STR $ (c) "*" STR $ (d) "= 24" exit function end if if aff. * b * c / D = 24 Then 22 = STR $ (a) "*" STR $ (c) "* STR $ (d) " = 24 "exit function e Nd if if a * b / (c d) = 24 Then calculation 24 = STR $ (a) "*" STR $ (b) "/ (" STR $ (c) " " STR $ (d) ") = 24" EXIT FUNCTION END IF IF A * B / C - D =
24 THEN 22 = STR $ (a) "*" STR $ (b) "/" STR $ (c) "-" STR $ (d) "= 24" exit function end ififf C = D THEN ELSEIF A * B / (C - D) = 24 Then 22 = STR $ (a) "*" STR $ (b) "/ (" STR $ (c) "-" STR $ (d) ") = 24" EXIT FUNCTION END IF A * (B / C - D) = 24 THEN calculation 24 = STR $ (a) "* (" STR $ (b) " / " STR $ (c) " - " STR $ (d) ") = 24 "EXIT FUNCTION END IF A * B / C / D = 24 THEN calculation 24 = STR $ (a) " * " STR $ (b) " / " STR $ (c) " / " STR $ (d) " = 24 "exit function end if if b = c / d THEN ELSEIF A / (B - C / d) = 24 THEN calculation 24 = STR $ (a) "/ (" STR $ (c) " STR $ (d) ") = 24 "EXIT FUNCTION END IF B / C = D THEN ELSEIF A / (B / C - D) = 24 Then calculation 24 = STR $ (a) " / (" STR $ (b) " / " STR $ (d) " - " STR $ (d) ") = 24 "exit function end if k = a: a = b: b = C: C = D: D = k next n k = b: b = c: c = D: D = k next jk = c: c = D: D = knext i count 24 = "This question is unfolied!" End function