VB编写程序题.写出“输出1-50之间,能被3整除的数,并累加这些数的和”的

问题描述:

VB编写程序题.写出“输出1-50之间,能被3整除的数,并累加这些数的和”的

private sub command1_click()
dim sum as integer
dim i as integer
sum=0
for i = 1 to 50
if i mod 3 =0 then
msgbox i &"能被3整除",VbOkOnly+VbInformation,"提示"
sum=sum+i
end if
next i
msgbox "这些数的和为" & sum,VbOkOnly+VbInformation,"提示"