Write a C++ program. Take 3×3 matrix to fill diagonal to make the sum of every row, column and diagonal equal Given 9 elements in a 3 x 3 matrix where the value of diagonals is 0. We need to find the...

Write a C++ program. Take 3×3 matrix to fill diagonal to make the sum of every row, column and diagonal equal Given 9 elements in a 3 x 3 matrix where the value of diagonals is 0. We need to find the values in diagonal to make the sum of every row, column and diagonal equal. Example Input 0 3 6 5 0 5 4 7 0 Output 6 3 6 5 5 5 4 7 4 Explanation: Now the value of the sum of any row or column is 15. Approach Let’s say the diagonal is x, y and z. The value of x will be ( x2, 3 + x3, 2 ) / 2. The value of z will be ( x1, 2 + x2, 1 ) / 2. The value of y will be ( x + z ) / 2.

Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here