Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - The format of the multiplication table 1 *1=1 1*1=2 1*1=2 1*9............. .............9*9=81 Programming with java
The format of the multiplication table 1 *1=1 1*1=2 1*1=2 1*9............. .............9*9=81 Programming with java

public class MultipleDemo

{

public static void main(String[] args)

{

final int num = 9; //Define an integer constant to facilitate modifying the multiplication table that outputs n*n;

for(int i=1;i<=num;i++)

{

for(int j=1;j<=i;j++)

{

System.out.print(j+"*"+i+ "="+i*j+"\t");

}

System.out.println();

}

}

}

Save the program as MultipleDemo.java, then compile and execute it; if you want to print a 4*4 multiplication table, just add the code

Change the value of num to 4.