I can't able to implement the code

i have implemented the same logic to find the sum of all submatrics of a given 2D array please help.

Check this :