use C language,
considering the matrix N * M. Replace all the elements of the array, the values of which are equal to the sum of their indices, ones.