Objective

Create a multiplication table for a randomly-chosen positive integer less than or equal to 100.

Difficulty

Very easy

Description

Time to go random!

In this exercise, you have to randomly come up with a positive integer less than or equal to 100, and then create a multiplication table for that integer starting at 1 and going all the way up to 12.

For instance, if the integer is 5, you'll compute 5 x 1, 5 x 2, ..., all the way upto 5 x 12.

For the output, start with the following line:

Multiplication table for <integer>:

where <integer> is the randomly-chosen integer.

Next up, comes the multiplication table. Leave a blank line before printing the multiplication table.

Each row of the table is to be presented on a new line in the following form:

<integer> x <i> = <product_i>

where <integer> is the randomly-chosen integer, <i> is the multiplier (starting at 1, and incrementing with each new row) and <product_i> is the product of these two numbers.

Shown below is an example to clarify all these outputs:

Multiplication table for 4: 4 x 1 = 4 4 x 2 = 8 4 x 3 = 12 4 x 4 = 16 4 x 5 = 20 4 x 6 = 24 4 x 7 = 28 4 x 8 = 32 4 x 9 = 36 4 x 10 = 40 4 x 11 = 44 4 x 12 = 48