c语言求所有m位绝对质数,找出所有二位绝对素数 vb程序

满意答案

dcebd7a0de6265b6ccae5ead692f1eab.png

xsghn

2013.11.20

dcebd7a0de6265b6ccae5ead692f1eab.png

采纳率:53%    等级:12

已帮助:5480人

Private Sub Command1_Click()

Dim i As Integer

Dim j As Integer

Dim SH As Integer

For i = 11 To 99 Step 2

SH = SuShu(i)

If SH = 1 Then

SH = 0

j = Val(Right(i, 1) & Left(i, 1))

SH = SuShu(j)

If SH = 1 Then

Print i

End If

End If

Next

End Sub

Private Function SuShu(i As Integer) As Integer

If i = 2 Or i = 3 Then

SuShu = 1

Exit Function

End If

If i Mod 2 = 0 Then

SuShu = 0

Exit Function

End If

Dim m As Integer

Dim j As Integer

m = Int(Sqr(i))

For j = 3 To m Step 2

If i Mod j = 0 Then

SuShu = 0

Exit Function

End If

Next

SuShu = 1

End Function

10分享举报

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值