2021年9月计算机二级考试web考前模拟(9月13日)
试利用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
以上就是“2021年9月计算机二级考试web考前模拟(9月13日)”及其相关内容,想及时获知各地准考证打印及考试时间,大家可通过环球网校“ 免费预约短信提醒”及时获得时间提醒。环球网校友情提示:为方便小伙伴们更好地备考,环球网校特地为大家准备了计算机二级复习资料,如有需要请点击文章下方“免费下载>>>2021年计算机二级考试模拟练习及备考资料”下载学习。