
用VBScript编程:在浏览器中输出1---999中能被3整除,且至少有一位数字是5的所有整数
1个回答
展开全部
两种方法:
1。
<%
dim t
for i=1 to 999
if i mod 3 =0 then
t=cstr(i)
for j=1 to len(t)
m=left(t,j)
m=right(m,1)
if m="5" then
response.write(i)
response.write("<br>")
exit for
end if
next
end if
next
%>
或者
2
<%
dim t
for i=1 to 999
if i mod 3 =0 then
if instr(cstr(i),"5")<>0 then
response.write(i)
response.write("<br>")
end if
end if
next
%>
刚整出来,整了半个小说,已经测试过。
1。
<%
dim t
for i=1 to 999
if i mod 3 =0 then
t=cstr(i)
for j=1 to len(t)
m=left(t,j)
m=right(m,1)
if m="5" then
response.write(i)
response.write("<br>")
exit for
end if
next
end if
next
%>
或者
2
<%
dim t
for i=1 to 999
if i mod 3 =0 then
if instr(cstr(i),"5")<>0 then
response.write(i)
response.write("<br>")
end if
end if
next
%>
刚整出来,整了半个小说,已经测试过。
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询