Implementation issues

I tried to code the concept that he taught in this video, but I am not getting the desired output, Can I get the proper coding implementation of Sum of All Submatrix From A given Matrix - Approach 2.

Refer this