Mar 2, 2007

C++ program to generate a table from any given number upto any given number

// or C++ program to generate a table between a given range.
// in this program there will be two input num1 and num2 and table will be
// generated between given num1 and num2.
#include<iostream.h>
#include<conio.h>
main()
{
clrscr();
int num1,num2;
cout <<"enter first number";
cin >> num1;
cout <<"enter second number";
cin >> num2;
for (int i=num1;i<=num2;i++)
{
for(int k=1;k<=10;k++)
{
cout << i*k<<endl;
}
getch();
}
getch();
}
Write above program in c++ editor and run. Give first input 2 and second input 5
then table will be generated from 2 to 5.

No comments:

Post a Comment