#K65442. Delta Matrix Generation
Delta Matrix Generation
Delta Matrix Generation
Given a positive integer n, generate an n x n delta matrix \(A\) defined by the formula:
\(A[i][j] = (i + j) \mod n\)
where \(i, j = 0,1,...,n-1\). The resulting matrix should be printed with each row on a new line and each element separated by a single space.
Note: Ensure that you read the input from stdin
and write your output to stdout
.
inputFormat
The input consists of a single integer n (2 ≤ n ≤ 1000), representing the size of the matrix.
outputFormat
Print the n x n delta matrix. Each row must be on a new line and elements in a row should be separated by a single space.
## sample2
0 1
1 0
</p>