C++ Program to print Table of number using Function

ad+1

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;
}

 

Output:

 

8 comments: Leave Your Comments

  1. I found nice article in your blog.thank you for useful info
    .

    ReplyDelete
  2. Informative article. Thanks for sharing such an valuable article. Also visit my website for Solid Inkjet Helpline. Solid Inkjet Helpline

    ReplyDelete
  3. Write a C program to Print table of entered number by user through keyboard using for loop.

    Code 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!

    ReplyDelete
  4. Amazing . I kind of understood it somehow but what does table (n) say? thank you

    ReplyDelete
  5. Amazing and very helpful for me thank you...

    ReplyDelete