In C++ write a program for a multiplication table
It must Prompt the user for two integers between 1 and 20 (inclusive) •
also must Calculates and displays the multiplication table in a well-formatted output
The table must include a label for each row and column
The program must follow the requirements:
• Validates user input, displaying an error message and prompting to user to enter another integer if the input is invalid, and repeating it as many times as necessary
• Uses nested loops to calculate and display the table
Uses library features to line up the table columns and rows
CODE IN C++:
#include <iostream>
using namespace std;
int main()
{
int n ;
cout << "Enter an integer(1-20) : ";
cin >> n ;
while( n < 1 || n > 20){
cout << "Reenter an integer(1-20) : ";
cin >> n ;
}
cout << "Multiplication table of " << n << endl
;
for(int i = 1; i <= 10; i++)
cout << n << " * " << i << " = " << n
* i << endl ;
return 0;
}
OUTPUT:
Get Answers For Free
Most questions answered within 1 hours.