输出如下:
1*1=1
1*2=2 2*2=4
1*3=3 2*3=6 3*3=9
———————-
———————-
请写出完整的ASP代码程序。
用ASP输出九九乘法口决表的网页
输出如下:
1*1=1
1*2=2 2*2=4
1*3=3 2*3=6 3*3=9
请写出完整的ASP代码程序。
参考答案如下:
方法1:
<html>
<head><title>九九乘法表</title><head>
<body>
<table border=1>
<%for i= 1 to 9%>
<tr>
<%for j= 1 to i%>
<td>
<%=j&”*”&i&”=”&j*i%>
<%next%>
</td>
<%for k=i+1 to 9%>
<td>
<%=” “%>
<%next%>
</td>
</tr>
<%next%>
</table>
</body>
方法2:
<%
dim a,b
a=1
while a<=9
for b=a to 9
response.Write cstr(a)&”*”&cstr(b)&”=”&cstr(a*b)&””
next
response.Write”<br>”
a=a+1
wend
%>
方法3:
<%for i=1 to 9%>
<%for j=1 to i%>
<%if j*i<10 then
response.write j&”*”&i&”=”&j*i&” “&” ”
else
response.write j&”*”&i&”=”&j*i&” ”
end if
%>
<%next%>
<%=”<br>”%>
<%for k=i+1 to 9%>
<%=” “%>
<%next%>
<%next%>
发表评论