知识库

关于ASP中FOR循环的小应用

来源: 本站    类别: 知识库    日期: 2016/8/1

 

          今天一大学同学突然问我一编程问题,让我用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 "&nbsp;&nbsp;"
  next
  
  for i = 1 to n
   response.write "*"
  next
  response.write "<br>"
 next
%>
</body>
</html>


相关文章


Copyright © 2004 - 2024 CNHWW Inc. All Rights Reserved
石家庄市征红网络科技有限公司版权所有 邮政编码:050051
服务电话:0311-85315152 13931185013 在线客服QQ:81447932 / 81447933 邮箱: cnhww@163.com