Exercise 3: Making Matrix Using Arrays

Display a matrix of zeros and ones by using a two-dimensional array.

Problem statement

Write a display function that takes an integer size, creates a 2D matrix of the specified size, and displays this matrix.

  • The diagonal of the matrix should be filled with 0.

  • The lower side of the diagonal should be filled with -1s.

  • The upper side of the diagonal should be filled with 1s.

Sample input