December 23, 2018
The average main diagonal
Square matrix is a matrix of rows and columns of equal. Matrix NxN square matrix called ranks N. AII elements constitute the main diagonal of a square matrix. (Diagonal from left to right, up to down).
Threads: Enter into a square matrix of degree n. Calculate the average of the main diagonal.
Input: The first line contains the number n. The next n lines each containing n integers separated by spaces.
Output: A unique number is an average to be calculated. Results rounded to 2 decimal.
For example:
input: 2 3 5 1 7 output: 5.00
You are not logged in? Log in to Submit Now!