在jsp中输出等腰三角形(练习3)

 1 <%@ page language="java" contentType="text/html; charset=UTF-8"
 2     pageEncoding="UTF-8"%>
 3 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 4 <html>
 5 <head>
 6 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 7 <title>Insert title here</title>
 8 </head>
 9 <body>
10  
11 <%
12 int a=20;
13 String str="";
14 for(int i=1;i<=a;i++)
15 {
16     
17     for(int b=1;b<=a-i;b++)
18     {
19         str+="&nbsp;&nbsp;";
20     }
21     for(int j=1;j<=2*i-1;j++)
22     {
23         str+="*";
24     }
25     str+="<br>";
26 }
27 %>
28 <%=str%>

posted @ 2016-06-24 10:17  明天会更好!!!!  阅读(1165)  评论(0)    收藏  举报