打印矩阵边界元素的Python程序
Boundary Elements of a Matrix
没有被属于同一矩阵的其他元素包围的元素被称为边界元素。利用这个现象,我们可以构建一个程序。让我们考虑一个输入输出的场景,然后构建一个程序。
输入输出场景
考虑一个矩阵(方阵)
The Boundary elements are the elements except the middle elements of the matrix.
矩阵的中间元素是5,除了5之外没有其他中间元素。
So, the Boundary elements are 9, 8, 7, 6, 4, 3, 2, and 1 as they are lying in the boundary positions of the matrix.
9 8 7 6 5 4 3 2 1 登录后复制