Here is a C++ program to print multiplication table of a number. To print multiplication table, we first take a number n and term(t) as input from user. We will use a for loop to print the multiplication table of n till t times.
C++ Program to Generate Multiplication Table
#include <iostream> using namespace std; int main() { int n, term, i; cout << "Enter a number to print multiplication table\n"; cin >> n; cout << "Enter number of terms in table\n"; cin >> term; /* Generate multiplication table */ for(i = 1; i <= term; ++i){ cout << n << " X " << i << " = " << n*i << endl; } return 0; }Output
Enter a number to print multiplication table 6 Enter number of terms in table 9 6 X 1 = 6 6 X 2 = 12 6 X 3 = 18 6 X 4 = 24 6 X 5 = 30 6 X 6 = 36 6 X 7 = 42 6 X 8 = 48 6 X 9 = 54
Recommended Posts