In this program we are going to print table of any number using function. Actually we will take input of an integer from a user and then we will pass that number to a function. And after passing number to function we will find table of that number using for loop.
Program:
// Program By http://solutionscpp.blogspot.com// Author Mansoor Ahmed
// GMail ID: secguy000@gmail.com
#include<iostream>
using namespace std;
int table(int n);
int main()
{
int n=0;
cout<<"Enter Number: ";
cin>>n;
table(n);
}
int table(int n)
{
int t=1;
cout<<"Table of " <<n << " is: " <<endl;
for(int i=1; i<=10; i++)
{
t=n*i;
cout<<n <<" * " <<i <<" = " <<t <<endl;
}
return 0;
}
the best
ReplyDeleteI found nice article in your blog.thank you for useful info
ReplyDelete.
Informative article. Thanks for sharing such an valuable article. Also visit my website for Solid Inkjet Helpline. Solid Inkjet Helpline
ReplyDeletegreat
ReplyDeleteWrite a C program to Print table of entered number by user through keyboard using for loop.
ReplyDeleteCode of given problem:
int main()
{
int i=0,num;
printf("Enter the number to find its table:\t");
scanf("%d", &num);
for(i=1;i<=10;i++)
{
printf("%d\n",num*i);
}
return 0;
}
Very informative blog!
Please take some time to visit my blog @
for loop program examples
Thanks!
Nice and logical way to print the tableAlternate way to print table.
ReplyDeleteAmazing . I kind of understood it somehow but what does table (n) say? thank you
ReplyDeleteAmazing and very helpful for me thank you...
ReplyDelete