<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> </head> <body> <h3>九九乘法表</h3> <hr> <% for(int a = 1; a <= 9; a++ ) { for(int b = 1; b <= a; b++ ) { out.println(a +"*"+ b +"="+a*b+"   ") ; //制表符 } %> <br> <% } %> <h3>三角形</h3> <hr> <% for(int a = 1; a <= 9; a++ ) { for(int b = 1; b <= a; b++ ) { out.println("*"+"  ") ; } %> <br> <% } %> <h3>菱形</h3> <hr> <% for(int i = 0; i < 9; i++) { for(int x = i + 1; x < 9; x++) { out.println("  "); } for(int y = 0; y < (i + 1) * 2 - 1; y++) { out.println("#"); } out.print("<br>"); } for(int i = 0; i < 9; i++) { for(int x = 0; x < i; x++) { out.println("  "); } for(int y = i; y < 2 * 9 - i - 1; y++) { out.println("#"); } out.print("<br>"); } %> </body> </html>
结果:
、