qq_35652318
2017-10-23 15:08
采纳率: 100%
浏览 1.1k

求大佬怎么用Dreamweaver算出100以内的素数

dim i,z
for i = 1 to 100 and (不知道啦)
if .....
next
求大佬填充图片说明

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • 子幽 2017-10-24 08:52
    已采纳
    //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
    
    点赞 打赏 评论
  • 子幽 2017-10-24 02:56
    
     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+',';
                }
    
    点赞 1 打赏 评论

相关推荐 更多相似问题