您的位置首页百科问答

VBScript (用循环嵌套和判断语句)

VBScript (用循环嵌套和判断语句)

for x=0 to 100

for y=0 to 100

if x*4+y*1=100 then exit for

Next

Next

if x<>100 and y<>100 then

Response.Write("大和尚"&x&"个,小和尚"&y&"个")

else

Response.Write("无解")

end if

一个循环

Private Sub CommandButton1_Click()

rs = 100

mt = 1000

dahs = 0

While dahs <= 1000

xhs = rs - dahs

If xhs / 4 + dahs * 4 = 100 Then

Response.Write("大和尚"&dahs&"个,小和尚"&xhs&"个")

End If

dahs = dahs + 1

Wend

End Sub