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;
}
Comments
Post a Comment
Add your comment here...