编写ASP程序循环显示星号

来源:百度知道 编辑:UC知道 时间:2024/05/16 03:11:21
请利用循环语句,编写一段小程序,使在页面上显示如下图形。
*
***
*****
*******
*********

这样就可以,各行分别是1、3、5、7、9个*号,
楼上的写错了,他的结果是各行分别是1、2、3、4、5个*号,
<%
for i=1 to 5
for j=1 to 2*i-1
response.write("*")
next
response.write("<br>")
next
%>

<%
for i=1 to 5
for z=1 to i
response.write("*")
next
response.write("<br>")
next
%>

我的方法最简单:
for i=1 to 9 step 2
response.Write(string(i,"*")&"<br>")
next