{"id":215321,"student_id":142,"content":"function gcd (a, b) {\n // noob progarm\n // while (a != b) {\n // if (a \u003e b) {\n // a = a-b;\n // } else {\n // b = b-a;\n // }\n // if (a == b) {\n // return a;\n // }\n // }\n\n\n // pro progarm (•̀ ω •́ )✧\n \n if(a==b){\n return a;\n }\n if(a\u003cb){\n return gcd(b-a,a)\n }else{\n return gcd(a-b,b)\n }\n\n}\n\n//測試\nfunction test (a, b, answer) {\n var result = gcd(a, b);\n console.log(`\n 程式算出 ${a} 和 ${b} 的最大公因數是 ${result}\n 正確答案是 ${answer} ,你${answer == result ? '答對了ಠ_ಠ': '答錯了( •̀ ω •́ )✧'}\n `);\n\n}\n\ntest(51, 85, 17);\ntest(60, 50, 10);\ntest(64, 48, 16);\ntest(99, 77, 11);\ntest(97, 17, 1);","created_at":"2020-12-26T11:05:52.626+08:00","updated_at":"2020-12-26T11:42:20.358+08:00","name":"輾轉相除法(預設版) 副本","language":"javascript","screenshot":{"url":"https://cdn1.koding.school/uploads/project/screenshot/215321/fd1ac05835b665cf0d7e3c5532c7c2d7.jpg"},"parent_id":163010,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":43,"hashid":"p93sk4eew","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
到這台電腦