dim i,zfor i = 1 to 100 and (不知道啦)if .....next求大佬填充
2 回答
繁花不似锦
TA贡献1851条经验 获得超4个赞
//vb什么的实在不懂,只能帮到这儿了 Private Sub Command1_Click() Dim i As Integer,j As Integer Dim sum As Integer,f As Boolean For i = 2 To 100 For j = 2 To i - 1 If i Mod j = 0 And i 2 Then f = True Exit For End If Next If Not f Then sum = sum + i f = False Next MsgBox sum End Sub
茅侃侃
TA贡献1842条经验 获得超21个赞
for (var i = 2; i < 100; i++) { var flag = true; for (var j = 2; j <= i / 2; j++) { if (i % j == 0) { flag = false; break; } } if (flag) var str=' '; str+=i+','; }
添加回答
举报
0/150
提交
取消