How to generate multiplication table in C?

We learn multiplication table from childhood, but to write them in C is a task that everyone can't solve.

This following program generates a multiplication table for user-defined number and range.


#include<iostream>
using namespace std;
int main()
{
    int a=5,b=1,res,limit;
    cout<<"Enter the length of the table\n";
    cin>>limit;
    do
    {
        res=a*b;
        cout<<"\na= "<<a<<" b= "<<b<<" res= "<<res;
        b++;

    }while(b<=limit);

return 0;
}

Thanks for reading. Share with the world.


Comments

Popular posts from this blog

How to calculate age using C program

ISRO develops India's fastest supercomputer - the GPU-architecture based SAGA-220.

Restart Windows Explorer manually after Explorer crashes