1.通过键盘输入一个自然数,判断是否为质数
2.在列表框(list1)中输出1~1000之间能被17整除的数,在编程前写明列表框的行来源属性值设计
Access程序设计
答案:2 悬赏:0 手机版
解决时间 2021-03-02 13:25
- 提问者网友:且恨且铭记
- 2021-03-01 22:25
最佳答案
- 五星知识达人网友:我住北渡口
- 2021-03-01 23:14
1、
Sub ZhiShu()
Dim X As Long
Dim X1 As Long
Dim BZ As Boolean
Dim temp
X = InputBox("请输入一个数字")
If CLng(X) <= 2 Then Exit Sub
X1 = Sqr(CLng(X))
For I = 2 To X1
temp = X / I
If temp = Int(temp) Then BZ = True: Exit For
End If
MsgBox X & IIf(BZ, "", "不") & "是一个质数"
End Sub2、
Sub LLLLLL()
Dim I As Integer
Dim X
For I = 1 To 1000
X = I / 17
If X = Int(X) Then List1.AddItem X
Next
End Sub
Sub ZhiShu()
Dim X As Long
Dim X1 As Long
Dim BZ As Boolean
Dim temp
X = InputBox("请输入一个数字")
If CLng(X) <= 2 Then Exit Sub
X1 = Sqr(CLng(X))
For I = 2 To X1
temp = X / I
If temp = Int(temp) Then BZ = True: Exit For
End If
MsgBox X & IIf(BZ, "", "不") & "是一个质数"
End Sub2、
Sub LLLLLL()
Dim I As Integer
Dim X
For I = 1 To 1000
X = I / 17
If X = Int(X) Then List1.AddItem X
Next
End Sub
全部回答
- 1楼网友:第四晚心情
- 2021-03-02 00:12
private sub command1_click() dim conn as new adodb.connection dim rs as new adodb.recordset conn.open "provider=microsoft.jet.oledb.4.0;data source=d:\mydb.mdb" '请输入实际路径及数据库的名字 dim sql as string dim s as string s = text3.text if text3.text = "" then msgbox "请输入软件版本?", vbinformation, "消息提醒" else sql = "select * from [mobile] where 软件版本='" & s & "'" rs.open sql, conn, 1, 3 if rs.eof then msgbox "此版本数据库中不存在,请重新输入!", vbexclamation, "消息提醒" else if len(rs.fields("是否认证")) = 0 then msgbox "此版本已经通过认证!", vbinformation, "消息提醒" else msgbox "你输入的软件版本未通过认证!请联系担当。", vbexclamation, "消息提醒!" end if end if end if end sub
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯