Write a NumPy program to compute the sum of the diagonal element of a given array. code example
Example: sum of diagonal numpy
arr= np.arange(16)
arr= np.reshape(arr,(4,4))
a=np.diagonal(arr, 0,0,1)
result=sum(a)
print(result)
arr= np.arange(16)
arr= np.reshape(arr,(4,4))
a=np.diagonal(arr, 0,0,1)
result=sum(a)
print(result)