Question

In C++ write a program for a multiplication table It must Prompt the user for two...

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

Homework Answers

Answer #1

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:

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Question: Write a C++ program to ask the user to give you the number of rows...
Question: Write a C++ program to ask the user to give you the number of rows and number of columns, then make the multiplication table by using nested loop. For example, if the user enters 3 for rows and 4 for columns then the multiplication table would be like the following: 1    2   3     4 1   1 2 3 4 2   2    4      6    8 3    3 6 9 12
Write a program in C++ coding that asks the user to input an integer between 25...
Write a program in C++ coding that asks the user to input an integer between 25 and 50, inclusive. Utilize a WHILE loop to test for INVALID input. If the input is INVALID, the loop will repeat, and ask the user to try again. The pseudocode looks like this: Prompt user to input an integer between 25 and 50 Accept the input from the user Test for invalid input (HINT: use a while loop and the OR operator with 2...
Write a program that asks the user to input an integer between 25 and 50, inclusive....
Write a program that asks the user to input an integer between 25 and 50, inclusive. Utilize a WHILE loop to test for INVALID input. If the input is INVALID, the loop will repeat, and ask the user to try again. The pseudocode looks like this: Prompt user to input an integer between 25 and 50 Accept the input from the user Test for invalid input (HINT: use a while loop and the OR operator with 2 relational expressions. You...
(AdditionTable.java) Write a program that displays the following addition table. Notes: You must use a nested...
(AdditionTable.java) Write a program that displays the following addition table. Notes: You must use a nested loop. There are spaces at the beginning of each row.
C++. Write a program that draws a rocket shape on the screen based on user input...
C++. Write a program that draws a rocket shape on the screen based on user input of three values, height, width and stages. The type of box generated (i.e.. a hollow or filled-in) is based on a check for odd or even values input by the user for the box height (or number of rows). Here is the general specification given user input for the height of the box..... Draw a hollow box for each stage if the value for...
Write a java program that creates an integer array with 50 random values, prompts the user...
Write a java program that creates an integer array with 50 random values, prompts the user to enter the index of an element in the array between 0 and 49, then displays the corresponding element value. If the specified index is out of bounds, display an error message (e.g. “Out of Bounds”) and ask the user to enter another index. Use a while loop that will keep prompting the user until a valid input is received. To handle invalid inputs,...
You will write a program that loops until the user selects 0 to exit. In the...
You will write a program that loops until the user selects 0 to exit. In the loop the user interactively selects a menu choice to compress or decompress a file. There are three menu options: Option 0: allows the user to exit the program. Option 1: allows the user to compress the specified input file and store the result in an output file. Option 2: allows the user to decompress the specified input file and store the result in an...
Write a program that allows two players to play a game of tic-tac-toe. Use a twodimensional...
Write a program that allows two players to play a game of tic-tac-toe. Use a twodimensional char array with three rows and three columns as the game board. Each element in the array should be initialized with an asterisk (*). The program should run a loop that: • Displays the contents of the board array. • Allows player 1 to select a location on the board for an X. The program should ask the user to enter the row and...
Part A. Input Validation (Name your C program yourLastName_yourFirstName_Lab4a.c) 1. Place the code you developed in...
Part A. Input Validation (Name your C program yourLastName_yourFirstName_Lab4a.c) 1. Place the code you developed in Lab 2 to obtain a diameter value from the user and compute the volume of a sphere (we assumed that to be the shape of a balloon) in a new program, and implement the following restriction on the user’s input: the user should enter a value for the diameter which is at least 8 inches but not larger than 60 inches. Using an if-else...
(SubtractionTable.java) Write a program that displays the following subtraction table. Notes: You must use a nested...
(SubtractionTable.java) Write a program that displays the following subtraction table. Notes: You must use a nested loop. There are spaces at the beginning of each row.                                                                                                                 2 - 1 = 1                                                                                                   3 - 1 = 2   3 - 2 = 1                                                                                   4 - 1 = 3   4 - 2 = 2   4 - 3 = 1                                                                   5 - 1 = 4   5 - 2 = 3   5 - 3 = 2   5 - 4 = 1  ...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT