九九乘法表

<%@ page language="java" contentType="text/html; charset=GB18030"
    pageEncoding="GB18030"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<title></title>
</head>
<body>
<%
    String str = ""; //声明保存九九乘法表的字符串变量
    //连接生成九九乘法表的字符串
    for (int i = 1; i <= 9; i++) { // 外循环
        for (int j = 1; j <= i; j++) { // 内循环
            str += j + "×" + i + "=" + j * i;
            str += "&nbsp;"; //加入空格符
        }
        str += "<br>"; // 加入换行符
    }
%>
<table width="440" height="85" border="1" cellpadding="0" cellspacing="0" style="font:9pt;" bordercolordark="#666666" bordercolorlight="#FFFFFF" bordercolor="#FFFFFF">
  <tr>
    <td height="30" align="center">九九乘法表</td>
  </tr>
  <tr>
    <td style="padding:3pt"><%=str %><!-- 输出九九乘法表 --></td>
  </tr>
</table>
</body>
</html>

posted @ 2013-04-25 22:00  glt66  阅读(150)  评论(0编辑  收藏  举报