This code will help you to get any number of table upto any number..
#include<iostream.h>
#include<conio.h>
main()
{
int i=1,table,numb,s,r;
cout<<"enter no to get table:";
cin>>table;
cout<<endl;
cout<<"enter no up to what u want table:";
cin>>numb;
cout<<endl;
cout<<"press 1 if u want straight table. or if u want reverse table press 2:";
cin>>s;
cout<<endl;
while(i<=numb)
{
if(s==1)
{cout<<table<<"x"<<i<<"="<<table*i<<endl;
i++;
}
else if(s==2)
{
cout<<table<<"x"<<numb<<"="<<table*numb<<endl;
numb--;
}
}
getch();
return 0;
#include<iostream.h>
#include<conio.h>
main()
{
int i=1,table,numb,s,r;
cout<<"enter no to get table:";
cin>>table;
cout<<endl;
cout<<"enter no up to what u want table:";
cin>>numb;
cout<<endl;
cout<<"press 1 if u want straight table. or if u want reverse table press 2:";
cin>>s;
cout<<endl;
while(i<=numb)
{
if(s==1)
{cout<<table<<"x"<<i<<"="<<table*i<<endl;
i++;
}
else if(s==2)
{
cout<<table<<"x"<<numb<<"="<<table*numb<<endl;
numb--;
}
}
getch();
return 0;
No comments:
Post a Comment