In this C++ example, we’ll learn How to generate multiplication table of given number.
The multiplication table is used to define a multiplication operation for any number. It is normally used to lay the foundation of elementary arithmetic operations with base ten numbers.
C++ Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #include <iostream> using namespace std; int main() { int n; cout << "Enter a positive integer: "; cin >> n; for (int i = 1; i <= 10; ++i) { cout << n << " * " << i << " = " << n * i << endl; } return 0; } |
Output: