码迷,mamicode.com
首页 > Web开发 > 详细

网页输出菱形

时间:2016-10-27 19:58:52      阅读:145      评论:0      收藏:0      [点我收藏+]

标签:int   分享   pre   div   ++   image   alt   src   style   

技术分享

 

<%

String str1="";

for(int i = 0 ; i <5 ;i ++)
{
    for(int j = 0 ; j <5-i;j++)
        str1+="&nbsp;"+"&nbsp;";
    for(int x = 0 ; x <2*i-1;x++)
        str1+="*";
        str1+="<br>";
}

%>

<%=str1 %>

<%

String str2="";
for(int i= 3 ; i > 0 ; i-- )
{
    for(int j=0 ; j < 5 -  i ; j++)    
        
        str2+="&nbsp;"+"&nbsp;";
        
    for(int x=0 ; x < 2*i-1 ; x++)
        str2+="*";
        str2+="<br>";        
}

%>

<%=str2 %>

 

网页输出菱形

标签:int   分享   pre   div   ++   image   alt   src   style   

原文地址:http://www.cnblogs.com/zs6666/p/6004908.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!