Private S As String = ""
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
For x = 0 To 100
For y = 0 To 100
For z = 0 To 100
If x ^ 2 + y ^ 2 + z ^ 2 = 2000 Then
If S = "" Then
S = "X=" & x & " Y=" & y & " Z=" & z
Else
S = S & vbCrLf & "X=" & x & " Y=" & y & " Z=" & z
End If
End If
Next z
Next y
Next x
Label1.Text = S
End Sub
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Label1.Text = ""
End Sub
#include
void main(){
int x,y,z;
for(x=0;x<45;x++)
for(y=0;y<45;y++)
for(z=0;z<45;z++)
if(x*x+y*y+z*z==2000)
printf("x=%2d y=%2d z=%2d\n",x,y,z);
}
你绝对是浙江科技学院的....