用vb来计算双平方数字?怎么计算。
答案:1 悬赏:20 手机版
解决时间 2021-11-30 11:13
- 提问者网友:咪咪
- 2021-11-29 16:05
用vb来计算双平方数字?怎么计算。
最佳答案
- 五星知识达人网友:蓝房子
- 2021-11-29 16:15
Public Function panduan(ByVal n As Integer) As Boolean
Dim res As Boolean = False
Dim a, b, c, d, temp1, temp2 As Integer
a = n 1000
b = (n 100) Mod 10
c = (n 10) Mod 10
d = n Mod 10
temp1 = Sqrt(n)
temp2 = Sqrt(a + b + c + d)
If temp1 * temp1 = n And temp2 * temp2 = (a + b + c + d) Then
res = True
End If
Return res
End Function
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
Dim str As String = "", temp As Integer = 0, sum As Integer = 0, x As Integer
For i = 1000 To 9999 Step 1
If panduan(i) Then
temp = i
Exit For
End If
Next
TextBox6.Text = temp
End Sub
Dim res As Boolean = False
Dim a, b, c, d, temp1, temp2 As Integer
a = n 1000
b = (n 100) Mod 10
c = (n 10) Mod 10
d = n Mod 10
temp1 = Sqrt(n)
temp2 = Sqrt(a + b + c + d)
If temp1 * temp1 = n And temp2 * temp2 = (a + b + c + d) Then
res = True
End If
Return res
End Function
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
Dim str As String = "", temp As Integer = 0, sum As Integer = 0, x As Integer
For i = 1000 To 9999 Step 1
If panduan(i) Then
temp = i
Exit For
End If
Next
TextBox6.Text = temp
End Sub
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯