2个回答
2014-03-04
展开全部
' VB .NET 控制台应用
Module Module1
Sub Main()
Dim i, a, b, c As Integer
i = 100
Do While i <= 999
a = i \ 100
b = i \ 10 Mod 10
c = i Mod 10
If a ^ 3 + b ^ 3 + c ^ 3 = i Then
Console.WriteLine(i) '控制台输出部分,可以修改成其他形式输出
End If
i = i + 1
Loop
End Sub
End Module
Module Module1
Sub Main()
Dim i, a, b, c As Integer
i = 100
Do While i <= 999
a = i \ 100
b = i \ 10 Mod 10
c = i Mod 10
If a ^ 3 + b ^ 3 + c ^ 3 = i Then
Console.WriteLine(i) '控制台输出部分,可以修改成其他形式输出
End If
i = i + 1
Loop
End Sub
End Module
2014-03-04
展开全部
Private Sub Command1_Click()
For i = 100 To 999
If IsPrime(i) Then
n = n + 1
Print i;
If n Mod 10 = 0 Then Print
End If
Next i
End Sub
Public Function IsPrime(ByVal num As Long) As Boolean
Dim m As Long
m = Sqr(num)
IsPrime = True
For i = 2 To m
If num Mod i = 0 Then
IsPrime = False
Exit For
End If
Next i
End Function
For i = 100 To 999
If IsPrime(i) Then
n = n + 1
Print i;
If n Mod 10 = 0 Then Print
End If
Next i
End Sub
Public Function IsPrime(ByVal num As Long) As Boolean
Dim m As Long
m = Sqr(num)
IsPrime = True
For i = 2 To m
If num Mod i = 0 Then
IsPrime = False
Exit For
End If
Next i
End Function
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询