《vb程序最大公约数.docx》由会员分享,可在线阅读,更多相关《vb程序最大公约数.docx(3页珍藏版)》请在第一文库网上搜索。
1、PrivateSubCommand1_C1ick()Dimi,sAsIntegeri=0s=ODoWhi1es10000i=i+Is=si1oop1abe12.Caption=使s=1+2+.+10000的最大值n的值是:&iEndSubPrivateSubCommand2_C1ick()a=CInt(Text1Text)b=CInt(Text2.Text)IfabThent=a:a=b:b=tEndIfr=aModbDoWhi1e(r0)a=b:b=rr=aModb1oop1abe16.Caption=Text1Text&”和“&Text2.Text&”的最大公约数为:”&bEndSubPr
2、ivateSubCOmmand3_C1ick()1abe12.Caption=,1abe16.Caption=,Text1Text=,hText2.Text=u,EndSubPrivateSubCommand4_C1ick()EndEndSubPrivateSubCommand5_C1ick()Form2.ShowForm1HideEndSubPrivateSubForm_1oad()1abe11.Caption=1.计算自然数的累加和s=1+2+.+n时要找出使S不大于IoOoO最大自然数n1abe13.Caption=求x1和x2的最大公约数?”EndSubPrivateSubCommand1_C1ick()n=0h=Va1(Text1Text)DoWhi1eh8848n=n+1h=2*h1oopText2.Text=nEndSubPrivateSubCommand2_C1ick()Text1.Text=u,Text2.Text=,hEndSubPrivateSubCOmmand3_C1ick()EndEndSub