Write pseudocode for an algorithm called MatrixManip which takes as input two n x n integer arrays A and B and does the following: (i) calculates the array C, the sum of the two arrays (ii) calculates the array D = 3C (iii)Calculates the difference between S1, the sum of the elements in the first array and S2, the sum of the elements of the second array. (b) Using python, implement the algorithm MatrixManip. Be sure to output the results to the screen. (c) Using a random number generator, populate two 5 x 5 matrices with numbers in the range from -30 to +50. Display your two arrays and the answers for part (a) above.
Write pseudocode for an
integer arrays A and B and does the following:
(i) calculates the array C, the sum of the two arrays
(ii) calculates the array D = 3C
(iii)Calculates the difference between S1, the sum of the elements in the first array and
S2, the sum of the elements of the second array.
(b) Using python, implement the algorithm MatrixManip.
Be sure to output the results to the screen.
(c) Using a random number generator, populate two 5 x 5 matrices with numbers in the range
from -30 to +50. Display your two arrays and the answers for part (a) above.
Solution:
Given,
i) calculates the array C, the sum of the two arrays
(ii) calculates the array D = 3C
(iii)Calculates the difference between S1, the sum of the elements in the first array and
S2, the sum of the elements of the second array.
(b) Using python, implement the algorithm MatrixManip.
Be sure to output the results to the screen.
(c) Using a random number generator, populate two 5 x 5 matrices with numbers in the range
from -30 to +50. Display your two arrays and the answers for part (a) above.
Step by step
Solved in 5 steps with 3 images