Subject: Re: 5x5 magic square
Date: Tue, 8 Jul 1997 21:27:21 -0400
From: Alexander Bogomolny

Dear Scott:

Your question is quite ambiguous. Assume I know a method for constructing a 5x5 magic square. I can do this on paper and then place a result into a C array ([5][5] or [25]). Is it what you want?

The second possibility is to provide an algorithm to construct a square (on paper or programmatically.) There are several algorithms known for an nxn square with n odd. But you ask only about n = 5.

Still assuming the latter, given an algorithm it may be translated into C code in a variety of ways. If you program in C you must be able to convert a Description into code. Then why do you ask about code?

Just in case, here is one solution (by Bachet's method):

31692215
20821142
72513119
24125186
114171023

Best,
Alexander Bogomolny

|Reply| |Up|

Copyright © 1996-2018 Alexander Bogomolny

71752537