科目名稱:資訊系統 與網路導論 | 開課系所:資訊工程 學系 | 任課教師 |
吳坤熹 |
||
系所別: |
年級: |
學號: |
姓名: |
考試日期 |
2010.10.20 |
(考試時間: 16:30-16:45)
(10%) Determine whether the following code is correct or not. If it is correct, predict its output. If it is incorrect, point out the mistake(s)
'factorial
n = 5
PRINT n; "! = "; factorial(n)
END
FUNCTION factorial(a)
PRINT a
IF a > 1 THEN
factorial = a*factorial(a-1)
ELSE ' Without this boundary condition,
factorial=1 ' the function will always return 0.
END IF
END FUNCTION