乘法口诀
<body>
<%
StringBuffer sb = new StringBuffer();
for(int i = 1; i <= 9; i++){
for(int j = 1; j <= i; j++){
sb.append(j + "*" + i + "=");
sb.append(j*i);
sb.append(" ");
}
sb.append("<br>");
}
%>
<%=sb.toString()%>
</body>
第二种:
<body>
<%
for (int i = 1, j = 1; i <= 9; i++, j++) {
if (j <= i) {
out.print(i + "*" + j + "=" + i * j + " ");
i--;
} else {
j = 0;
out.print("<br/>");
}
}
%>
</body>
posted on 2015-10-26 23:20 kebizhanmushi 阅读(101) 评论(0) 编辑 收藏 举报