75 75 votes An $n \times n$ array $v$ is defined as follows: $v\left[i,j\right] = i - j$ for all $i, j, i \leq n, 1 \leq j \leq n$ The sum of the elements of the array $v$ is $0$ $n-1$ $n^2 - 3n +2$ $n^2 \frac{\left(n+1\right)}{2}$ Data Structures gatecse-2000 data-structures array easy + – Kathleen 19.3k views answer comment Share Follow Print See all 12 Comments 12 12 Comments reply Show 9 previous comments R2-D2 commented Aug 22, 2025 reply Follow flag ditto chat gpt answer 👏 1 1 replyShare js__ commented Dec 5, 2025 reply Follow flag take a small n X n size array then run the values , it will be 0 1 1 replyShare Vishal_Jaiswal commented Aug 21 reply Follow flag the range of i must be 1<= i <= n instead of i<=n 0 0 replyShare Please log in or register to add a comment.
Best answer 75 75 votes The sum of the $i^{th}$ row and $i^{th}$ column is $0$ as shown below. Since, the numbers of rows equals the number of columns, the total sum will be $0$.$$\begin{array}{|l|l|l|l|l|} \hline \text{0} & \text{-1} & \text{-2} & \text{-3} & \text{-4}\\\hline \text{1} & \text{0} & \text{-1} & \text{-2} & \text{-3} \\\hline \text{2} & \text{1} & \text{0} & \text{-1} & \text{-2} \\\hline \text{3} & \text{2} & \text{1} & \text{0} & \text{-1}\\\hline \text{4} & \text{3} & \text{2} & \text{1} & \text{0}\\\hline \end{array}$$Correct Answer: $A$ Arjun answered Nov 17, 2014 • edited Apr 30, 2019 by Naveen Kumar 3 Arjun comment Share Follow See all 8 Comments 8 8 Comments reply Show 5 previous comments T Shubham commented May 11, 2025 reply Follow flag If you take the sum then 0 + (-1) + (-2) + 1 + 0 + (-1) + 2 + 1 + 0 = 0 0 0 replyShare CSgirl commented May 22, 2025 reply Follow flag how V is an array? It is matrix right.. 0 0 replyShare Ekalavyaa commented Apr 3 reply Follow flag @CSgirlit is given that V is an n*n array so,you can say that V is a two dimensional array i.e v[n][n] 1 1 replyShare Please log in or register to add a comment.
32 32 votes If you look at code carefully it is very clear matrix getting defined is skew symmetric matrix. Sum of all elements in skew symmetric matrix is 0. Answer :-A 0 Akash Kanase answered Nov 20, 2015 Akash Kanase comment Share Follow 0 reply Please log in or register to add a comment.
20 20 votes Let there are total N rows . You will find ∑ of elements of row i + ∑ of elements row (N-i+1) = 0. So if N is even then row 1 + row N =0 row 2 + row (N-1) =0 row 3 + row (N-2)=0 similarly row (N/2) + row (N/2+1) =0. (So total sum is 0) But if N is odd then row ((N+1)/2) will have no corresponding rows BUT Ithe summation of elements of this row is 0 . So for N = even or Odd , the sum of element is 0 . Palash Nandi 1 answered Nov 16, 2014 Palash Nandi 1 comment Share Follow 0 reply Please log in or register to add a comment.
9 9 votes i think we can easily get it without drawing matrix as expression given v[i, j] = i - j suppose i1-j1=k1 {for a particular index } so its opposit index shows j1-i1=-k1, for example if v[1,2]=x then v[2,1]=-x} so we have cases here 1. for all i>j v[i, j] = i - j and jut for opposit indexof v[i, j] = i - j , v[j, i] = j - i =-(i-j) :: note this is for non diagonal elements 2. for all i=j v[i, j] = i - j=0 :: note this is for diagonal elaments so total sum will be zero ucan easily get it by seeing above cases saurabh rai answered Oct 12, 2016 saurabh rai comment Share Follow 0 reply Please log in or register to add a comment.
8 8 votes sum of all elements =n*( $\sum_{i=1}^{n}i-\sum_{j=1}^{n}j )= 0$ Niraj Singh 2 answered Dec 10, 2017 Niraj Singh 2 comment Share Follow 0 reply Please log in or register to add a comment.
7 7 votes ans is option (a) i.e 0 solution: suppose if n=3 then i<=3 and 1<=j<=3 i.e i=1,2,3, and j=1,2,3 => v={i-j}=(0,-1,-2,1,0,-1,2,1,0} sum of elements in v=0 prakash answered Nov 17, 2014 • edited Nov 17, 2014 by prakash prakash comment Share Follow See all 2 Comments 2 2 Comments reply Sahil1994 commented Jan 15, 2018 reply Follow flag @prakash What if i take, i=0,1,2. and j=1,2,3...? then it will be skew symmetric matrix..? 0 0 replyShare Lingaraj_G_M commented Jan 23 reply Follow flag same here 0 0 replyShare Please log in or register to add a comment.