3. (20 pts) Multiplication Table A multiplication table (shown below) is a tool
ID: 3929590 • Letter: 3
Question
3. (20 pts) Multiplication Table A multiplication table (shown below) is a tool commonly used by children in elementary school to help them learn to multiply numbers. The top row consists of integers from 0 to 12, increasing from left to right, while the leftmost column consists of integers from 0 to 12 increasing from top to bottom (the top-left corner contains an "X" to denote the multiplication operation). Every other element in the multiplication table is the product of the number at the very top of its column and the number at the very left of its row. Write a MATLAB script to create an array that contains the multiplication table as shown below-but instead of an "X" in the top-left corner, put a zero (0) in the (1,1) element of your array. (Hint: You can “manually" create the two topmost rows and two leftmost columns, and then use nested for loops to automatically populate the remaining elements in the array.) X01 23 4 567 8 9 10 11 12 0123 4 56 789 10 11 12 0 2 46 8 10 12 14 16 18 20 22 24 0 3 69 12 15 18 21 24 27 30 33 36 0 48 12 16 20 24 28 32 36 40 44 |48 0 5 10 15 20 25 30 35 40 45 50 55 60 0 6 12 18 24 30 36 42 48 54 60 66 72 0 7 14 21 28 35 42 49 56 63 70 77 84 0 8 16 24 32 40 48 56 64 72 80 88 96 09 18 27 36 45 54 63 72 81 90 99 108 0 | 10 | 20 | 30 | 40 | 50 | 60 I 70 I 80 I 90 1001 1011 20 0 11 22 33 44 55 66 77 88 99 110121132 0 12 24 36 48 60 72 84 96 10812013214 2 4 5 6 7Explanation / Answer
% matlab code
row = 12;
column = 12;
for i=0:row
for j=0:column
product = i*j;
table(j+1,i+1) = product;
end
end
disp(table);
%{
output:
0 0 0 0 0 0 0 0 0 0 0 0 0
0 1 2 3 4 5 6 7 8 9 10 11 12
0 2 4 6 8 10 12 14 16 18 20 22 24
0 3 6 9 12 15 18 21 24 27 30 33 36
0 4 8 12 16 20 24 28 32 36 40 44 48
0 5 10 15 20 25 30 35 40 45 50 55 60
0 6 12 18 24 30 36 42 48 54 60 66 72
0 7 14 21 28 35 42 49 56 63 70 77 84
0 8 16 24 32 40 48 56 64 72 80 88 96
0 9 18 27 36 45 54 63 72 81 90 99 108
0 10 20 30 40 50 60 70 80 90 100 110 120
0 11 22 33 44 55 66 77 88 99 110 121 132
0 12 24 36 48 60 72 84 96 108 120 132 144
%}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.