改成VB整数由3个平方数组成
答案:1 悬赏:20 手机版
解决时间 2021-03-25 01:06
- 提问者网友:像風在裏
- 2021-03-24 00:40
改成VB整数由3个平方数组成
最佳答案
- 五星知识达人网友:低音帝王
- 2021-03-24 01:04
Private Sub Command1_Click()
Dim number As Integer, i As Integer, j As Integer, k As Integer, l As Integer
number = Val(InputBox("please enter a number="))
For i = 1 To number / 2 - 1
For j = 0 To i
For k = 0 To j
For l = 0 To k
If number = i ^ 2 + j ^ 2 + k ^ 2 + l ^ 2 Then
Print number & "=" & i & "*" & i & "+" & j & "*" & j & "+" & k & "*" & k & " + " & l & "*" & l
End If
Next
Next
Next
Next
End Sub追问输入99,C结果只有一条,你这个VB有多条何解追答在End if 前 一行 加一句 exit sub 就可以了 我把c 里的 return(0)忽略了
Dim number As Integer, i As Integer, j As Integer, k As Integer, l As Integer
number = Val(InputBox("please enter a number="))
For i = 1 To number / 2 - 1
For j = 0 To i
For k = 0 To j
For l = 0 To k
If number = i ^ 2 + j ^ 2 + k ^ 2 + l ^ 2 Then
Print number & "=" & i & "*" & i & "+" & j & "*" & j & "+" & k & "*" & k & " + " & l & "*" & l
End If
Next
Next
Next
Next
End Sub追问输入99,C结果只有一条,你这个VB有多条何解追答在End if 前 一行 加一句 exit sub 就可以了 我把c 里的 return(0)忽略了
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯