雖然迭代用遞歸來做就夠了,但C語言提供了循環語句使迭代程序寫起來更方便。例如 factorial 用 while 語句可以寫成: int factorial(int n) { int result = 1; while ...
確定! 回上一頁