challenging task
Posted: Fri May 21, 2004 12:31 am
i want to write a program in assembly language in which user gives an even number (suppose 4),the program makes a matrix of rows and columns equal to number given by user.
this n*n matrix should be in such form that the sum of elements of any row or column or any diagnul should be same and no number should be repeated in matrix.
e.g
x1 x2 x3 x4
x5 x6 x7 x8
x9 x10 x11 x12
x13 x14 x15 x16
then
x1+x2+x3+x4=x13+x14+x15+x16=x3+x7+x11+x15=x13+x10 +x7+x4
so you can see if add any row or column or diagnul,the answer is same
i've tried the whole day without any success.
please tell me what will be the logic behind it.
this n*n matrix should be in such form that the sum of elements of any row or column or any diagnul should be same and no number should be repeated in matrix.
e.g
x1 x2 x3 x4
x5 x6 x7 x8
x9 x10 x11 x12
x13 x14 x15 x16
then
x1+x2+x3+x4=x13+x14+x15+x16=x3+x7+x11+x15=x13+x10 +x7+x4
so you can see if add any row or column or diagnul,the answer is same
i've tried the whole day without any success.
please tell me what will be the logic behind it.