Question: Programming Assignment 7 requirement: Requirement: array, two functions for calculation, and one function for displaying the formatted outputs An array is a data structure containing
Programming Assignment 7 requirement:
Requirement: array, two functions for calculation, and one function for displaying the formatted outputs
An array is a data structure containing a number of data values, known as elements.
Initialize a two-dimensional array, int arr[10][10];

Make a function of multiplication named, getMul(int i, int j), and make a function of summation named, getSum(int i, int j).
getMul() returns i x j and getSum() returns i+j.
getMul(): Each element has the value multiplication, e.g., arr[i][j] = i x j.
arr[0][0] = 0, arr[0][1] = 0,..., arr[3][3] = 9, ..., arr[4][1] = 4, ..., arr[9][9]=81
getSum(): Each element has the value sum, e.g., arr[i][j] = i+j.
arr[0][0] = 0, arr[0][1] = 1, ..., arr[3][3] = 6, ..., arr[4][1]=5..., arr[9][9]=18
Make a function named, displayOutput function to print out two-dimensional arrays as shown in examples.
The function can be void displayOutput(int i, int j);
A main function can call those getMul, getSum, and displayOutput functions.
For Example:
Enter your row number to display, i: 3
Enter your column number to display, j: 51
Invalid number, please try it again 0
Enter your column number to display, j: 5
Pick your function
1) Multiplication ixj. 2) Summation i+j. 3) Quit a program
Your selection: 2

Another Example:
Enter your row number, i: 11
Invalid number, please try it again 0
Enter your row number to display, i: 1
Enter your column number to display, j: 3
Pick your function
1) Multiplication ixj. 2) Summation i+j. 3) Quit a program
Your selection: 3
Your program is terminated!
\begin{tabular}{|l|l|l|l|l|l|l|l|l|l|l|} \multicolumn{1}{r|}{0} & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\ \hline \end{tabular} 0 1 \begin{tabular}{|l|l|l|l|l|} \multicolumn{1}{l}{0} & 1 & 2 & 3 & 4 \\ \hline 0 & 1 & 2 & 3 & 4 \\ \hline 0 & 2 & 3 & 4 & 5 \\ \hline 0 & 3 & 4 & 5 & 6 \\ \hline \end{tabular}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
