1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | Sub Main() Dim matrix(,) As Integer = { {1, 2, 3} , {2, 4, 2} , {3, 2, 1} } If IsPersymmetric(matrix) Then Console . WriteLine("Матрица персимметрична.") Else Console . WriteLine("Матрица не персимметрична.") End If End Sub Function IsPersymmetric(matrix(,) As Integer ) As Boolean Dim rows As Integer = matrix . GetLength( 0 ) Dim cols As Integer = matrix . GetLength( 1 ) If rows <> cols Then Return False End If For i As Integer = 0 To rows - 1 For j As Integer = 0 To cols - 1 If matrix(i, j) <> matrix(rows - j - 1 , rows - i - 1 ) Then Return False End If Next Next Return True End Function |