Introduction: In this article i will explain with example
program to print table of any entered number using for loop in C++ Language.
In previous article i explained How to find greatest of three numbers using multiple if statement and What is For loop in C++ Language? Example program to print counting up to given limit and What is goto statement,its advantages and disadvantages with program example and Get number of days in month,year using nested if and Program to check for vowel or consonant using switch case and many other C++ programs.
Implementation: Let's create a program to print table using C++ Language.
#include<conio.h>
#include<iostream.h>
void main()
{
int num,i,table=0;
clrscr();
cout<<"Enter any number: ";
cin>>num;
for(i=1;i<=10;i++)
{
table=num*i;
cout<<num<<" *
"<<i<<" = "<<table<<endl;
}
getch();
}
- Run the program using Ctrl+F9
Output:
Enter any number: 7
7 * 1 = 7
7 * 2 = 14
7 * 3 = 21
7 * 4 = 28
7 * 5 =35
7 * 6 = 42
7 * 7 = 49
7 * 8 = 56
7 * 9 = 63
7 * 10 = 70Now over to you:
"If you like my work; you can appreciate by leaving your comments, hitting Facebook like button, following on Google+, Twitter, Linked in and Pinterest, stumbling my posts on stumble upon and subscribing for receiving free updates directly to your inbox . Stay tuned and stay connected for more technical updates."
If you have any question about any post, Feel free to ask.You can simply drop a comment below post or contact via Contact Us form. Your feedback and suggestions will be highly appreciated. Also try to leave comments from your account not from the anonymous account so that i can respond to you easily..