Practice

Times Table Procedure

EASYProcedures & Functions5 marks

Write procedure TimesTable(N) that outputs the 1-to-5 times table for N, one line per multiplier, in the form <N> x <k> = <product>.

Input: One integer N. Output: Five lines.

Example:

Input:  3
Output: 3 x 1 = 3
        3 x 2 = 6
        3 x 3 = 9
        3 x 4 = 12
        3 x 5 = 15
Premium is coming soon. All grading features are currently unlocked.

Sample Test Cases

Test 1: 3 times table
Inputs: 3
Expected: 3 x 1 = 3 3 x 2 = 6 3 x 3 = 9 3 x 4 = 12 3 x 5 = 15
Test 2: 1 times table
Inputs: 1
Expected: 1 x 1 = 1 1 x 2 = 2 1 x 3 = 3 1 x 4 = 4 1 x 5 = 5