# Multiplication table Java Exercise - Java Programming Course

### Example Code

``````import java.util.*;
public class Main
{
public static void main(String[] args)
{
int x;
int result;
System.out.println("Enter a number:");
x = Integer.parseInt(new Scanner(System.in).nextLine());
result = x * 0;
System.out.printf("The result is: %1\$s x %2\$s = %3\$s" + "\r\n", x, 0, result);
result = x * 1;
System.out.printf("The result is: %1\$s x %2\$s = %3\$s" + "\r\n", x, 1, result);
result = x * 2;
System.out.printf("The result is: %1\$s x %2\$s = %3\$s" + "\r\n", x, 2, result);
result = x * 3;
System.out.printf("The result is: %1\$s x %2\$s = %3\$s" + "\r\n", x, 3, result);
result = x * 4;
System.out.printf("The result is: %1\$s x %2\$s = %3\$s" + "\r\n", x, 4, result);
result = x * 5;
System.out.printf("The result is: %1\$s x %2\$s = %3\$s" + "\r\n", x, 5, result);
result = x * 6;
System.out.printf("The result is: %1\$s x %2\$s = %3\$s" + "\r\n", x, 6, result);
result = x * 7;
System.out.printf("The result is: %1\$s x %2\$s = %3\$s" + "\r\n", x, 7, result);
result = x * 8;
System.out.printf("The result is: %1\$s x %2\$s = %3\$s" + "\r\n", x, 8, result);
result = x * 9;
System.out.printf("The result is: %1\$s x %2\$s = %3\$s" + "\r\n", x, 9, result);
result = x * 10;
System.out.printf("The result is: %1\$s x %2\$s = %3\$s" + "\r\n", x, 10, result);
}
}``````