烟台高新区楼盘:JAVA乘法表怎么写?

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/06 04:27:55
1*1=1
1*2=2 2*2=4
1*3=3 2*3=6 3*3=9
1*4=4 2*4=8 3*4=12 4*4=16
.........................
.....................依此类推
第一行1×1=1靠右边依此下推,就是上面那种水平翻转

public class Multiplicaiton
{
public static void main(String[] args)
{
for (int i = 1; i <= 9; i++)
{
for(int n = 1; n <= i; n++)
{
System.out.print( i + " x " + n + " = " + i * n + " ");
}
System.out.println();
}
}
}

/**
* Author: Liu Weijun
* Date: 2005.11.23
* Description: page for a travel
*
*/
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class BruceTravelRequest extends HttpServlet {

public void doPost(
HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {

/**
* Indicate the content type (for example, text/html),
* being returned by the response 20
*/
response.setContentType("text/html");

/**
* Retrieve an output stream to use to send data to the client
*/
PrintWriter out = response.getWriter();

/**
* Get the user input from the form : name and destination
*/
/* Add your code here */

String useName = request.getParameter("Name");

String useDestination = request.getParameter("Destination");

/** 41
* Start by building the web page header
*/
/* Add your code here */
out.println(
"<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>");
out.println("<HTML>");
out.println("<HEAD>");
out.println("<TITLE>iCarnegie Travel Agency</TITLE>");
out.println("</HEAD>");
out.println("<BODY bgcolor='oliver'>");

/**
* Add the image
*/
/* Add your code here */

out.println("<IMG src='/" + useDestination
+ "' alt='" + useDestination + "'>");

/**
* Add the confirmation message, with the name
*/
/* Add your code here */

out.println("<br><font size=6 color=red><B>Hello, "+useName+"!<br></b></font>");
out.println(
"<font size=6 color=red><B>Thanks for your request. <br> You will be contacted shortly.</b></font>");

/**
* End by building the web page footer
*/
/* Add your code here */

out.println("</BODY>");
out.println("</HTML>");

} // end-doPost

}

for(int i=1;i<=9;i++){
for(ing j=1;j<=i;j++)
System.out.print(i+"*"+j+"="+i*j+"\t");

System.out.println();//换行
}

这不是九九乘法表吗

我问谁