=3)")k = 0For i = 2 To Sqr(n)If n Mod i = 0 Then k = 1Next iIf k = 0 ThenPrint n; "是一个素数"ElsePrint n; "不是素数"End IfEnd Sub" /> =3)")k = 0For i = 2 To Sqr(n)If n Mod i = 0 Then k = 1Next iIf k = 0 ThenPrint n; "是一个素数"ElsePrint n; "不是素数"End IfEnd Sub - 作业答案大全" />

vb循环语句中sqr(n)是什么意思for i=2 to sqr(n) 中sqr(n)代表什么意思?我只能肯定不是开根号的意思!Private Sub Form_Click()Dim n As Integern = InputBox("请输入一个正整数(>=3)")k = 0For i = 2 To Sqr(n)If n Mod i = 0 Then k = 1Next iIf k = 0 ThenPrint n; "是一个素数"ElsePrint n; "不是素数"End IfEnd Sub

问题描述:

vb循环语句中sqr(n)是什么意思
for i=2 to sqr(n) 中sqr(n)代表什么意思?我只能肯定不是开根号的意思!
Private Sub Form_Click()
Dim n As Integer
n = InputBox("请输入一个正整数(>=3)")
k = 0
For i = 2 To Sqr(n)
If n Mod i = 0 Then k = 1
Next i
If k = 0 Then
Print n; "是一个素数"
Else
Print n; "不是素数"
End If
End Sub