今天一大学同学突然问我一编程问题,让我用ASP帮她编写输出一如下图形:
*
***
*****
*******
一时间我还想不起该怎么回答了,相当惭愧。研究了半天才写出来了,感觉相当丢人。代码如下:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<%
dim n,i,a,b
for n=1 to 7 step 2
i = 0
a = 0
b = (7 - n)/2
for a = 1 to b
response.write " "
next
for i = 1 to n
response.write "*"
next
response.write "<br>"
next
%>
</body>
</html>