Doubt in creating prefix sum matrix

Hello, could you please help me in creating a prefix sum matrix.

Here is my code :

hello @yashsharma4304
idea is simple .
a)first compute rowise prefix sum then
b) compute columwise prefix sum

check this->

1 Like

Now, will this code only works in case of a square matrix(n x n). I am asking this question because I have entered m x n matrix and it is not giving me the correct output.

Here is the code :
https://ide.codingblocks.com/s/367540

@yashsharma4304
check now->

1 Like

Ok that was my mistake. Thank u for solving the issue :slightly_smiling_face: