vb求出1到100之间3和7的倍数来,分别计算出它们数值得和,并输出。
来源:百度知道 编辑:UC知道 时间:2024/08/23 18:01:55
dim a as integer ,b as integer
dim sa as integer, sb as integer
dim na as string, nb as string
for i = 1 to 100
if i mod 3 =0 then
na= na & cstr(i) & " "
sa=sa+i
elseif i mod 7 =0 then
nb= nb & cstr(i) & " "
sb=sb+i
endif
next
print na
print sa
print nb
print sb
dim s as integer,k as integer
for i=1 to 100
if i mod 3 = 0 then
s=s+i
elseif i mod 7 = 0 then
k=k+i
end if
next i
print s
print k