Question
Write a program in C language (printf/scanf) to display multiplication tables. Ask the user for the number of multiplication tables to display, and validate using
Write a program in C language (printf/scanf) to display multiplication tables.
Ask the user for the number of multiplication tables to display, and validate using a loop that the number is between 2 and 10 inclusive. Store the minimum and maximum numbers in constants and use the constants in the prompts and validation.
Use nested for loops to create the multiplication tables. 3 nested loops will be required: an outer loop for the number of multiplication tables wanted by the user; a middle loop for the products from 1 to 10 for each number, and an inner loop that shows the repetitive addition (which is what multiplication is all about).
Hints:
Validation error messages are indented 3 spaces
The 1st number shown in the table is the counter for the outer loop (the number of tables wanted)
The 2nd number shown in the table is the counter for the middle loop (the numbers from 1 to 10)
Use a tab to align the first equal signs
The inner loop should run from 1 to the 2nd number
Use a decision to decide when the plus sign should be displayed (if there are more numbers to be added, display the plus sign)
The product is the 1st number multiplied by the 2nd number
Dont forget the blank line before Press any key to continue
Example Run:
(bold type is what is entered by the user)
Enter an integer between 2 and 10 inclusive: 12
The number entered, 12, must be between 2 and 10.
Please re-enter an integer between 2 and 10 inclusive: 3
Here are the multiplication tables from 1 to 3:
1 x 1 = 1 = 1
1 x 2 = 1 + 1 = 2
1 x 3 = 1 + 1 + 1 = 3
1 x 4 = 1 + 1 + 1 + 1 = 4
1 x 5 = 1 + 1 + 1 + 1 + 1 = 5
1 x 6 = 1 + 1 + 1 + 1 + 1 + 1 = 6
1 x 7 = 1 + 1 + 1 + 1 + 1 + 1 + 1 =7
1 x 8 = 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 8
1 x 9 = 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 9
1 x 10 = 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 10
2 x 1 = 2 = 2
2 x 2 = 2 + 2 = 4
2 x 3 = 2 + 2 + 2 = 6
2 x 4 = 2 + 2 + 2 + 2 = 8
2 x 5 = 2 + 2 + 2 + 2 + 2 = 10
2 x 6 = 2 + 2 + 2 + 2 + 2 + 2 = 12
2 x 7 = 2 + 2 + 2 + 2 + 2 + 2 + 2 = 14
2 x 8 = 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 = 16
2 x 9 = 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 = 18
2 x 10 = 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 = 20
3 x 1 = 3 = 3
3 x 2 = 3 + 3 = 6
3 x 3 = 3 + 3 + 3 = 9
3 x 4 = 3 + 3 + 3 + 3 = 12
3 x 5 = 3 + 3 + 3 + 3 + 3 = 15
3 x 6 = 3 + 3 + 3 + 3 + 3 + 3 = 18
3 x 7 = 3 + 3 + 3 + 3 + 3 + 3 + 3 = 21
3 x 8 = 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 = 24
3 x 9 = 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 = 27
3 x 10 = 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 = 30
The example run shows EXACTLY how your program input and output will look.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started