Drop links or images here to add them to the editor.

A times tables reference sheet.

★☆☆

The 1-12 times tables are something you learn when you are young. This program outputs a handy reference sheet for a times table.

Times tables

Make

Write a program to output the times table between one and twelve for a number.

Success Criteria

Remember to add a comment before a subprogram, selection or iteration statement to explain its purpose.

Complete the subprogram called times_table that:

  1. Takes a parameter x which is the times table to be output.
  2. Outputs the times table of x between 1 and 12.

Complete the main program so that:

  1. The user can input the times table they want to output.
  2. It calls the times_table subprogram.

Typical inputs and outputs from the program would be:

Which table do you want to output? 1-12:
3
1 x 3 = 3
2 x 3 = 6
3 x 3 = 9
4 x 3 = 12
5 x 3 = 15
6 x 3 = 18
7 x 3 = 21
8 x 3 = 24
9 x 3 = 27
10 x 3 = 30
11 x 3 = 33
12 x 3 = 36
🆘 If you're really stuck, use this Parsons code sorting exercise
Complete program
// Times tables program

using System;

class Submission
{
---
    // -------------------------
    // Subprograms
    // -------------------------
    // Procedure to output the X times table.
---
    static void times_table(int x)
    {
---
        // Output table 1-12
        for (int counter = 1; counter < 13; counter++) {
---
            Console.WriteLine($"{counter} x {x} = {counter * x}");
---
        }
---
    }
---


    // -------------------------
    // Main program
    // -------------------------
    public static void Main(string[] args)
    {
---
        Console.WriteLine("Which table do you want to output? 1-12:");
        int table = Convert.ToInt32(Console.ReadLine());
        times_table(table);
---
    }
---
}