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):

3 | 16 | 9 | 22 | 15 |

20 | 8 | 21 | 14 | 2 |

7 | 25 | 13 | 1 | 19 |

24 | 12 | 5 | 18 | 6 |

11 | 4 | 17 | 10 | 23 |

Best,

Alexander Bogomolny

62075282 |