I have a 2D array where rows = 3 and columns = 2. I want to get a sum of all the indices. Here is my array.
arr[][] = [1, 2], [3, 4], [5, 6]
Row 1
At
index (0, 0)the sum of indexes becomes(0 + 0 = 0)At
index (0, 1)the sum of indexes becomes(0 + 1 = 1)Row 2
At
index (1, 0)the sum of indexes becomes(1 + 0 = 1)At
index (1,1)the sum of indexes becomes(1 + 1 = 2)Row 3
At
index (2, 0)the sum of indexes becomes(2 + 0 = 2)At
index (2, 1)the sum of indexes becomes(2 + 1 = 3)
My expected output becomes
0 1 1 2 2 3
I am unable to find any resource, how to do this