# C++ Program to Print the Table of a Number

Writing a program to print the multiplication table of a given number is one of the questions you may get as a computer science student. So if you want to learn how to print the table of any number using the C++ programming language, this article is for you. In this article, I will introduce you to a tutorial on how to write a C++ program to print the table of a number.

## C++ Program to Print the Table of a Number

One of the best ways to learn a new programming language is to solve as many questions as possible. It helps you learn the syntax of the programming language you are learning and also helps you improve your coding skills. Writing a program to generate a multiplication table of any number is a very popular question. You might not get such questions in your coding interviews, but there are more chances to get this question in your computer science exams. So here is how you can write a C++ program to print the table of a number:

```Enter the number to print the table: 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```

In the above code, I have introduced three variables as product, counter, and number. The number is being used as the input variable where the user will enter a number for which the user wants to generate the multiplication table. The counter variable is being used as counting from 1 to 10 where the number will be multiplied by the counter. And the product is the output that we are getting after the multiplication of numbers and the counter variable.

In this program, I used the goto statement in C++ which is nothing more than a control statement used to jump to a specific point in the program after a particular condition is met.

### Summary

So this is how you can write a C++ program to generate the table of any number. Writing a program to print the multiplication table of a given number is one of the questions you may get as a computer science student. I hope you liked this article on how to write a C++ program to print the table of a number. Feel free to ask your valuable questions in the comments section below. ##### Aman Kharwal

I'm a writer and data scientist on a mission to educate others about the incredible power of data📈.

Articles: 1535