# Thread: Magic Square!!!... :D

1. Member
Join Date
Feb 2010
Posts
2
Rep Power
0

## Magic Square!!!... :D

Hello people!.

You might be interested for coding this program!... I'm new to the 2d array thing and I can't code using it, it's kind a confusing.

It is a program that can generate a magic square with an odd number of rows. The number of rows should be entered by the user of the program at run time. The minimum number of rows that may be entered is 3. You may provide a limit to the number of rows (You may set the maximum number of rows that may be entered.)

A magic square is an array of integers where the sums of columns, rows and diagonals are equal.

Examples of magic squares (with the grids on it)

3-row magic square
8 1 6
3 5 7
4 9 2

5-row magic square
17 24 1 8 15
23 5 7 14 16
4 6 13 20 22
10 12 19 21 3
11 18 25 2 9

could you give me the code?
thanks
Last edited by joms999; 02-24-2010 at 05:36 PM.

2. Originally Posted by joms999
... can you code it?...
Yes, but I won't take the fun of doing it away from you.

3. Originally Posted by joms999
... can you code it?... challenge for all... :)
Mweh, that's no challenge; I can even code it without using any storage proportional to n, the size of that matrix; can you do it?

kind regards,

Jos

4. Originally Posted by joms999
Hello people!.
You might be interested for coding this program!... I'm new to the 2d array thing and I can't code using it, it's kind a confusing.
....

could you give me the code?
thanks
Nice try. Now go do your own homework. :rolleyes:

5. Senior Member
Join Date
Oct 2009
Location
California,US
Posts
201
Rep Power
12
Nice try! but
if you are having trouble with 2d arrays make some small programs that might clear your doubts. Read some books or articles on that. Its not too hard neither is the question over here.Its not rocket science. Just need to spend some time on programming over the question. That should do the trick

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•