Write a program that prints a multiplication table for a given number and the number of rows in the table. For example, for a number 5 and rows = 3, the output should be: 5x1=5 5 x 2=10 5 x 3=15
Example: Write a program that prints a multiplication table for numbers up to 12.
public class Main {
public static void main(String[] args) {
for (int y = 1; y <= 12; ++y) {
for (int x = 1; x <= 12; ++x) {
System.out.printf("%4d", y*x);
}
System.out.println();
}
}
}