Baekjoon Algorithm | Problem 2739: Multiplication Table

Source

https://www.acmicpc.net/problem/2739

Problem

Solve Baekjoon Online Judge problem 2739, Multiplication Table.

Input

Follow the input format and constraints given in the original problem statement.

Output

Print the answer required by the problem.

Sample Input 1

2

Sample Output 1

2 * 1 = 2 2 * 2 = 4 2 * 3 = 6 2 * 4 = 8 2 * 5 = 10 2 * 6 = 12 2 * 7 = 14 2 * 8 = 16 2 * 9 = 18

Solution

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            int input = Integer.parseInt(br.readLine());

            for (int i = 1; i < 10; i++) {
                System.out.println(input + " * " + i + " = " + (input * i));
            }
        }
    }
}