点击查看:2018年9月计算机二级Web强化练习题及答案汇总
试利用VBScript编写一个求1~500之间的同时能被3除余2,被5除余3,被7除余2的所有数的页面
<%
dim n
for n = 1 to 500
if_________ ____ ___________ ___ __________ then
response.write n & ","
next
%>
答:
n mod 3 = 2
and
n mod 5 = 3
and n
mod 7 = 2
试利用VBScript编写一个求1~100中所有的质数的页面.
补全如下代码:
<%
response.write "1~100中所有的质数:"
for n=2 to 100
i=2
l=0
do while _____and______
if_____ then
l=1
else
i=i+1
end if
loop
if l=0 then response.write n & ","
next
%>
答:
i<=int(sqr(n))
l = 0
n mod i = 0
使用VBSCRIPT脚本,编写一段程序,求100~999中的所有水仙花数。
水仙花数:a^3+b^3+c^3=abc.请补全如下代码:
<%
dim n,a,b,c
response.write "100~999中的水仙花数有:"
for _____
a=_____
b=__________
c=_________
if ___________then response.write n & ","
next
%>
答:
n=100 to 999
left(n,1)
left(right(n,2),1)
right(n,1)
n=a^3+b^3+c^3
微信搜索"考试吧"了解更多考试资讯、下载备考资料
相关推荐: