Question: Create a C program that will print a multiplication table to the screen. First prompt the user to enter an integer, which will be used
Create a C program that will print a multiplication table to the screen. First prompt the user to enter an integer, which will be used as the size of the multiplication table. For example, if the user enters a 5, it will show the product of two values ranging from 1 to 5. The output should look something like the following examples:
Enter an integer to display the multiplication table from 1 to N: 3
X 1 2 3
1 1 2 3
2 2 4 6
3 3 6 9
Enter an integer to display the multiplication table from 1 to N: 5
X 1 2 3 4 5
1 1 2 3 4 5
2 2 4 6 8 10
3 3 6 9 12 15
4 4 8 12 16 20
5 5 10 15 20 25
Keep in mind for the numbers to align in each column, each number must be evenly spaced regardless of the length of the number. In the above examples the integers displayed are evenly spaced 4 characters apart, this can be done by using the %4dspecifier with printf()or fprintf().
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
