An n × n array v is defined as follows: v[i, j] = i − j for all i, j, 1 <= i…

GATE · 2000 · CS · Question 1 subparts

An n × n array v is defined as follows:

v[i, j] = i − j for all i, j, 1 <= i <= n, 1 <= j <= n

The sum of the elements of the array v is

  1. A.

    0

  2. B.

    n−1

  3. C.

    n² − 3n + 2

  4. D.

    n²(n+1)/2

Attempted by 737 students.

Show answer

Correct answer: A

The worked solution is available to enrolled students.

Video solution available to enrolled students.

Explore the full course: Iocl Engineers Officers Grade A Paper 2

Loading lesson…