Problem 2 - Diagonal Matrix

Problem 2 - Diagonal Matrix

Given a square matrix size N x N, calculate the product of
the sums across the

two main diagonals. For example, given the matrix:

Input format - via txt file:

Then first line contains an integer X which is the number of
test cases

Each test case contains an integer N which is the dimensions
of the square matrix

This will be followed by the contents of the matrix being
read left to right



Diagonal 16

4 5 7

3 1 5

9 3 2

Output Format - console

Print the product of the sums of the diagonals ((4 + 1 + 2)
(9 + 1 + 7))

Line separated please


Code is provided in Java to run STIN from a text file

Feel free to rewrite this in any language
Powered by