{"id":252076,"student_id":3469,"content":"//迴圈版\n// function fib (day) {\n// var a = 1;\n// var b = 1;\n// for (var i = 2; i \u003c day; i++) {\n// var sum = a + b;\n// a = b;\n// b = sum;\n// }\n// return b;\n// }\n\n//遞迴版(天數不可超過40, 電腦會爆炸)\nfunction fib (day) {\n if (day \u003e 2) {\n return fib(day - 2) + fib(day - 1);\n } else {\n return 1;\n }\n}\n\n//測試\nfunction test (day, answer) {\n var result = fib(day);\n console.log(`根據程式算出,第 ${day} 月有 ${result} 隻兔子 ${answer == result ? '答對了😃':'答錯了😡'}`);\n}\n\ntest(1, 1);\ntest(2, 1);\ntest(3, 2);\ntest(4, 3);\ntest(5, 5);\ntest(6, 8);\n\n","created_at":"2021-05-09T14:06:49.073+08:00","updated_at":"2021-05-09T14:24:41.847+08:00","name":"費氏數列(預設版) 副本","language":"javascript","screenshot":{"url":"https://cdn3.koding.school/uploads/project/screenshot/252076/fd1ac05835b665cf0d7e3c5532c7c2d7.jpg"},"parent_id":163011,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":89,"hashid":"vngsy9n4d","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦