Diagonal

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

 

Ex.

3

 

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

119

 

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

Feel free to rewrite this in any language
click BUY NOW BUTTON for solution
YOU MAY ALSO LIKE :ANAGRAM https://sellfy.com/p/xxLq

STAIRS https://sellfy.com/p/Euhi/
Powered by