已知s=1+2+3+...+n,找出最大的n,使得S<30000,用VB程序

2025-03-01 22:02:10
推荐回答(1个)
回答1:

private sub command1_click()
dim i,s as integer
s=0
for i=1 to 10000
s=s+i
if s>=30000 then
msgbox "the max N is:" & i-1 & "."
exit sub
endif
next i
end sub