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.
Write a program to output the times table between one and twelve for a number.
Remember to add a comment before a subprogram, selection or iteration statement to explain its purpose.
times_table that:x which is the times table to be output.x between 1 and 12.times_table subprogram.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
// 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);
---
}
---
}