首页 > Web开发 > 详细

网页输出菱形

时间:2016-10-27 19:56:33      阅读:249      评论:0      收藏:0      [点我收藏+]

技术分享

 

<%

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 %>

 

网页输出菱形

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!