Program to print the sum of boundary elements of a matrix is discussed here. Given a matrix, the task is to print the boundary elements of the matrix and display their sum.
For example, consider the matrix given below.
1 2 3
4 5 6
7 8 9
Boundary Matrix
1 2 3n4 6n7 8 9n
Sum of boundary elements: 1 + 2 + 3 + 4 + 6 + 7 + 8 + 9 = 40
@@coding::1@@
Recommended Programs