Tuesday, 24 March 2015

How to write table of any number in C++

How to write table of any number in C++    To write table in C++ we use the for loop. #include<iostream.h> int main() { ... thumbnail 1 summary

How to write table of any number in C++ 

 

To write table in C++ we use the for loop.
#include<iostream.h>
int main()
{
    int number;
    int end;
    int c;
    cout<<"enter the table number"<<endl;
    cin>>number;
    cout<<"enter the number of turns "<<endl;
    cin>>end;
    for(int b=1;b<=end;b++)
    {
    c=number*b;
    cout<<number<<" * "<<b<<" = "<<c<<endl;
    }
    system("pause");
    return 0; 
    }