The output is not coming

Can you tell me where have i done a mistake i used the same formula showed in the video but its not giving the satisfactory output

Hello @soul_coder,

The junk values are getting added and subtracted from the sum for the cases:

When li=0
when lj=0
You have to check for these cases before computing the sum.
Modified Code:

Hope, this would help.
Give a like if you are satisfied.