English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
所有分類

如何用vb 6.0 寫最大公因數跟最小公倍數的程式
想不出來..請大大指點一下

2006-04-27 04:31:53 · 2 個解答 · 發問者 little bear 4 in 電腦與網際網路 程式設計

好複雜阿@"@
有簡單點的寫法嗎?我還是新手....

2006-04-27 21:38:15 · update #1

2 個解答

Private Sub Command1_Click()'求15 & 60 之最大公因數及最小公倍數Print GCD(15, 60)Print GCM(15, 60)End Sub'最大公因數Function GCD(ByVal S1 As Long, ByVal S2 As Long) As LongDim T As LongDo While S1 Mod S2 <> 0  T = S1 Mod S2: S1 = S2: S2 = TLoopGCD = S2End Function'最小公倍數Function GCM(ByVal S1 As Long, ByVal S2 As Long) As LongGCM = S1 * S2 / GCD(S1, S2)End Function

2006-04-27 08:31:43 · answer #1 · answered by W.J.S. 7 · 0 0

到我的部落格看看吧!

不知道在哪裡,就看自我介紹的地方不就有了。

2006-04-27 18:38:50 · answer #2 · answered by 世賢 7 · 0 0

fedest.com, questions and answers