C++ Program to print table of any number
In this program, You will learn how to print table of any number in C++.
14 Table is :14 28 42 56 70 84 98 112 126 140
Example: How to print a table of any number in C++.
#include<iostream>
using namespace std;
int main() {
int n, i, r;
cout << "Enter any number:";
cin>>n;
for (i = 1; i <= 10; i++) {
r = n * i;
cout <<n <<" * " << i <<" = "<< r << endl;
}
return 0;
}
Output:
Enter any number:10
10 * 1 = 10
10 * 2 = 20
10 * 3 = 30
10 * 4 = 40
10 * 5 = 50
10 * 6 = 60
10 * 7 = 70
10 * 8 = 80
10 * 9 = 90
10 * 10 = 100