C / C++ program to print the table for a particular number

Leave a Comment
/* The following C/C++ program will print the table of any number entered. The following program can be extended to print tables for 'n' numbers by inserting the table() function in a loop or making multiple call of it */

Code:
#include<iostream>
#include<conio.h>
using namespace std;
void table (int a)
{
int i=1;
while (i<=10)
{
cout<<a<<"*"<<i<<"="<<a*i<<endl;
i++;
}
}
int main ()
{
int a;
cout<<"Enter Number:";
cin>>a;
cout<<endl<<"Table of Number :"<<a<<endl;
table(a);
getche();
return 0;
}


Output:
Output of C / C++ program to print the table for a particular number
Output of C / C++ program to print the table for a particular number

0 comments: