Showing posts with label table. Show all posts
Showing posts with label table. Show all posts

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

Read More...

C++ Program/Code to print table form 1-10;

Leave a Comment
//In this program, there will be a generation of Multiplication Tables from 1 to 10

#include<iostream.h>                   //For Input/Output Stream Related Functions
#include<conio.h>                         //For Console Input/Output function like clrscr & getche

void main()
{
clrscr();                                           //For Clearing the screen
int i,j;

for(i=1;i<=10;i++)                         //Counting From 1 to 10
{
for(j=1;j<=10;j++)                        //Counting From 1 to 10
{
cout<<i*j<<"\t" ;                         //Generating Table Elements
}
cout<<endl;                                  //For Next Table in New Line
}

getche();                                        //For exiting the program, after a keystroke
}
Read More...