How to print a multiplication table of 9×9 in Java?
In Java, you can print the multiplication table by using nested loops, the code is as follows:
public class MultiplicationTable {
public static void main(String[] args) {
for (int i = 1; i <= 9; i++) {
for (int j = 1; j <= i; j++) {
System.out.print(j + " * " + i + " = " + (i * j) + "\t");
}
System.out.println();
}
}
}
By running the above code, the result of the multiplication table for the nine times nine can be output.