Question: Q2) Write a function that calculates the sum of even elements in the right-diagonal and the left diagonal. Then prints the results and print the
Q2) Write a function that calculates the sum of even elements in the right-diagonal and the left diagonal. Then prints the results and print the elements of matrix A in the main. The following is the matrix: int A[4114]22, 23, 78, 28 }, 44, 65, 77, 18}, 132,23, 20, 13}, 15,25, 10, 15} I; The sum of the even elements in the right diagonal-28 The sum of the even elements in the left diagonal-42 void sumEven(int A[I[4], int &right, int &left, int size); Note to distinguish the diagonals: Left diagonal elements are Aij where i-j Right diagonal elements Aij where i+j = size-1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
