Write a program that input value and range from user ,display multiplication table to a given range by using for ,while and do while loops.
The program is as follows
#include <iostream>
using namespace std;
int main()
{
int n, range;
cout << "Enter an integer: ";
cin >> n;
cout << "Enter range: ";
cin >> range;
for (int i = 1; i <= range; ++i) {
cout << n << " * " << i << " = " << n * i << endl;
}
return 0;
}
Comments
Leave a comment