點擊查看: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
微信搜索"考試吧"了解更多考試資訊、下載備考資料
相關推薦: