编制函数,判断一个数是否同时被17与37整除,输出并统计1000到2000之间的所有能同时被17与37整除的数

来源:百度知道 编辑:UC知道 时间:2024/05/10 23:15:55

function fn(n) as boolean
fn=n mod 17=0 and n mod 37=0
end function

private sub Form_Click()
for i = 1000 to 2000
if fn(i) then print i
next i
end sub

dim i as long
for i=1000 to 2000
if (i mod (17* 37))=0 then
if (i mod 17)=0 then
debug.print i
end if
end if
next i

y=17*37
for s=1000 to 2000
if s mod y =0 then
print s;
end if
next s