Symmetric matrix

Report a typo

Given the number n, not exceeding 10, and a matrix of size n × n.

Check whether this matrix is symmetric in relation to the main diagonal. Output the word “YES”, if it is symmetric and the word “NO” otherwise.

Keep in mind that the main diagonal runs from the top left corner to the bottom right corner.

Sample Input 1:

3
0 1 2
1 2 3
2 3 4

Sample Output 1:

YES
Write a program in Java 17
class Main {
public static void main(String[] args) {
// put your code here
}
}
___

Create a free account to access the full topic