




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Private Sub Comma nd1_Click( Dim a As In tegerDim b As In tegerDim m As In tegerDim n As In tegera = InputBox(输入 a 的值 b = InputBox(输入 b 的值If a b The nm = bn = aElsem = an = bEnd Ifr = m Mod nDo While r 0 m = nn = rr = m Mod nLoopPrint a与b的最大公约数为;n End SubPrivate Sub Comma nd1O_Click( Dim i As In teg
2、erDim j As In tegerFor i = 1 To 4Print Tab(20 - 2 * i;Forj = 1 To iPrint 2 * i - 1;NextPrintNextEnd SubPrivate Sub Comma nd11_Click( Dim i As In tegerDim j As In tegerDim n As In tegerDim s As LongDim flag As Boolea nFor i = 100 To 1000flag = TrueForj = 2 To i- 1If i Mod j = 0 Thenflag = FalseExit F
3、orEnd IfNext jIf flag Thenn = n + 1s = s + iPrint i;If n Mod 10 = 0 The nPrintEnd IfEnd IfNext iPrintPrint n=; n, s=; sEnd SubPrivate Sub Comma nd12_Click( For m = 1 To 5Print Tab(70 - 3 * m;For n = 1 To 2 * m - 1If n = 1000 ThenExit ForEnd IfNextPrint 1+2+3.+n 1000 的最大 n 值为;n - 1 End SubPrivate Sub
4、 Comma nd15_Click(Dim m As In teger, n As In tegerCisPrintFor n = 1 To 5Print Tab(2 * n + 2;For m = n To 10 - nPrint Spc(1; *;NextPrint Spc(4;For m = 1 To 2 * n - 1Print Spc(1; *;NextPrintNextEnd SubPrivate Sub Comma nd16_Click(Dim i As In tegerDim j As In tegerFor i = 1 To 5Print Tab(20 - 3 * i;For
5、j = 1 To 2 *i - 1Print 2 * i - 1;Next jPrintNext iEnd SubPrivate Sub Comma nd17_Click(Dim n As In teger, i As In teger n = InputBox(输入数值For i = 1 To nPrint Spc(n - 1m = String(2 * i - 1, *Print mNext iEnd SubPrivate Sub Comma nd18_Click(Dim i As In teger i = InputBox(输入判断的数值If i Mod 2 = 0 The nPrint
6、 i;是偶数ElsePrint i;是奇数End IfEnd SubPrivate Sub Comma nd19_Click(Dim x As In teger, fiag As Boolea nDim n As In teger, s As LongFor x = 100 To 1000flag = Truen = 2Do While n xIf x Mod n = 0 The nflag = FalseEnd Ifn = n + 1LoopIf flag ThenEnd IfNext xPrint 100到1000之间的素数和为;s End SubPrivate Sub Comma nd2
7、_Click(Rem水仙花数Dim x As In teger, y As In teger, z As In teger Dim i As In teger i = 100Do While i = 999x = i100y = (i Mod 100 10z = i Mod 10If i = x A 3 + y A 3 + z A 3 The nPrint i;End Ifi = i + 1LoopEnd SubPrivate Sub Comma nd20_Click(Dim a As Strin g, i As In tegerDim k As In tegera = ABCDEFGk =
8、Len(aFor i = i To kPrint Right(a, iNext iEnd SubPrivate Sub Comma nd21_Click(Rem 1+2.+100Dim x As In tegerDim i As Longi = 0y = 1Do While y = 100i = i + yy = y + 1LoopPrin t 1+2.+100=; iEnd SubPrivate Sub Comma nd22_Click(Rem前n项和Dim x As In teger, y As In tegerDim n As In tegerDim i As Longn = Input
9、Box(输入 n 的值i = 0y = 1Do While y = ni = i + yy = y + 1LoopPrint iEnd SubPrivate Sub Comma nd23_Click( Rem 2到 100 的素数输出Dim a As In tegerDim i As In tegerFor a = 2 To 100Do While i a - 1 The nPrint a;j = j + 1If j Mod 10 = 0 Then Print End IfNextEnd SubPrivate Sub Comma nd24_Click( Dim cj As In tegerDi
10、m dj As Stri ngcj = InputBox(请输入成绩If cj = 0 And cj = 100 The nSelect Case cjCase Is 60dj = ECase Is 70 dj = DCase Is 80 dj = CCase Is 90 dj = BCase Is = 100dj = AEnd SelectEnd IfPrint cj;的成绩等级是;djEnd SubPrivate Sub Comma nd25_Click(Print * 3 4 5 6 7 8 Print For j = 12 To 24 Step 3Print Format(j, ; |
11、;For i = 3 To 8Print Format(j * i, ;NextPrintNextEnd SubPrivate Sub Comma nd26_Click(Rem 1到100奇数和Dim i As In teger, sum As Long sum = 0i = 1Do While i 99i = i + 2sum = sum + iPrint i;j = j + 1 分行If j Mod 10 = 0 Then PrintLoopPrint sumEnd SubPrivate Sub Comma nd27_Click(Dim i As Sin gle, s As Stri ng
12、 Ran domizei = RndPrint iIf i 0.5 The ns =正面Elses =反面End IfPrint sEnd SubPrivate Sub Comma nd28_Click(Dim i As Integer, j As Integer, n1 As Integer, n2 As Integer j = 0Do While j 0.5 The nn1 = n1 + 1Else n2 = n2 + 1End IfLoopPrint n1, n2End SubPrivate Sub Comma nd29_Click(RCq * * *Dim n As In tcgcrn
13、 = InputBox(输入 n 的值For i = 1 To nPrint Spc(n - 1m = String(2 * i - 1, *Print mNext iEnd SubPrivate Sub Comma nd3_Click(Dim x As In tcgcrDim y As In tcgcrDim s As Stri ng x = InputBox(输入 x 的值 y = InputBox(输入 y 的值If x 0 And y 0 The ns =第一象限Elself x 0 The ns =第二象限Elself x 0 And y 0 The ns =第三象限Elses =第
14、四象限End IfPrint点(;x; ,; y;在;sEnd SubPrivate Sub Comma nd30_Click(Forj = 1 To 9Fori = 1 TojPrint Format(i, ; *; j; =; Format(j * i, ;Next iPrintNext jEnd SubPrivate Sub Comma nd4_Click(Dim i As In tegerDim j As In tegerDim s As Stri ngi = InputBox(输入判断的月份j = InputBox(输入判断的年份Select Case iCase 1,3, 5, 7
15、, 8, 10, 12s = 31 天Case 4, 6, 9, 11s = 30 天Case 2If j Mod 4 = 0 And j Mod 100 0 Or j Mod 400 = 0 Then s = 29 天Elses = 28 天End IfEnd SelectPrint 这个月有;sEnd SubPrivate Sub Comma nd5_Click(Rem求n的阶乘Dim i As In tegerDim s As LongDim n As In tegern = InputBox(输入阶乘数值s = 1i = 0Do While i ni = i + 1s = s * iL
16、oopPrint n;的阶乘为;sEnd SubPrivate Sub Comma nd6_Click( Dim a As In tegerDim i As In tegera = InputBox(输入数值i = 2Do While i = nIf a Mod i = 0 ThenExit DoEnd Ifi = i + 1LoopIf i a - 1 The nPrint a;不是素数ElsePrint a;是素数End IfEnd SubPrivate Sub Comma nd7_Click( Dim a As In tegerDim flag As Boolea nflag = Tru
17、ea = InputBox(输入要判断的值i = 2Do While i = a - 1flag = FalseEnd Ifi = i + 1LoopIf flag ThenPrint a;是素数ElsePrint a;不是素数End IfEnd SubPrivate Sub Comma nd8_Click( Dim n As In tegerDim k As LongDim s As Long n = InputBox(输入数值s=1 k=0 For i = 1 To n s=s*i k=k+s Next Text1.Text = k End Sub Private Sub Command9_Click( Dim i As Inte
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 古诗教学设计与实践反思
- 仓储物流自动化管理系统操作指南
- 汽车维修周期性保养标准流程
- 高校教师教学能力提升方案探讨
- 外墙涂料防水施工安全规范
- 教师职业倦怠调研分析报告
- 医院基础设施维护与管理方案
- 2024年度公司员工培训计划
- 2025-2030智慧农业技术应用与农产品品牌建设发展策略
- 2025-2030智慧农业农业物联网与农业自动化研究
- 铜绿假单胞菌下呼吸道感染专家共识
- 保安员政审表
- GB/T 2078-2019带圆角圆孔固定的硬质合金可转位刀片尺寸
- 教师如何做课题研究课件
- 《新媒体概论(第三版)》课件第5章
- 教学第六章-海洋资源与海洋经济课件
- 三国全面战争秘籍大全
- DBJ50-112-2016 现浇混凝土桥梁梁柱式模板支撑架安全技术规范
- 城市轨道交通运营管理毕业论文题目
- 武汉近现代重要史迹和代表性建筑
- 2021智慧树答案运动安全与健康-研究生校内课 知到网课章节测试答案
评论
0/150
提交评论