Write a program that will print the table of any number upto any number.
input :
Enter the table of which number : 4
Enter upto which number : 5
Output
4 x 1 = 4
4 x 2 = 8
4 x 3 = 12
4 x 4 = 16
4 x 5 = 20
Continue (Y/N) ?
PROGRAM:
#include <iostream.h>
#include <conio.h>
void main() {
clrscr();
long int num,term;
cout<<"Enter the number for the table: ";
cin>>num;
cout<<"Enter the term upto which the table is to be generated: ";
cin>>term;
cout<<"The table is:\n";
for(int i=1;i<=term;i++)
cout<<num<<" X "<<i<<" = "<<num*i<<" \n";
getch();
}//end of the program
No comments:
Post a Comment