Givena n*n 2d array, fill the array from 1 to n*n to this 2d array such that sum of diagonals and row and column are equal
Answers
Answered by
5
Answer:
Input: N = 3
Output: 1 5 9
2 6 7
3 4 8
Sum in 1st row: 15
Sum in 2nd row: 15
Sum in 2nd row: 15
Input: N = 5
Output: 1 7 13 19 25
2 8 14 20 21
3 9 15 16 22
4 10 11 17 23
Similar questions