-->
当前位置:首页 > 题库

PROGRAMMING:Matrix diagonal summation

Luz5年前 (2021-05-10)题库410
Experiment 5: array
The purpose of this study was to investigate the effects of different factors on the quality of life
1. Master the definition, assignment, input and output methods of one-dimensional array and two-dimensional array.
2. Master the use of character array and string function.
Title Description
Find an n × The sum of the main diagonal elements of the integer matrix of n.
###Input format:
In the first line, enter the integer n (2 < = n < = 10) to represent n × The integer matrix of N; Enter n × N integers separated by spaces.
###Output format:
The sum of the main diagonal elements of the output matrix.
###Input example:
Here is a set of inputs. For example:
```in
three
1 3 5
6 7 9
2 4 8
```
###Output example:
The corresponding output is given here. For example:
```out
sixteen
```







answer:If there is no answer, please comment