Results 1 to 5 of 5
  1. #1
    joms999 is offline Member
    Join Date
    Feb 2010
    Posts
    2
    Rep Power
    0

    Default 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 04:36 PM.

  2. #2
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default

    Quote Originally Posted by joms999 View Post
    ... can you code it?...
    Yes, but I won't take the fun of doing it away from you.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  3. #3
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,519
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by joms999 View Post
    ... 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. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by joms999 View Post
    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. #5
    [RaIdEn] is offline Senior Member
    Join Date
    Oct 2009
    Location
    California,US
    Posts
    201
    Rep Power
    5

    Default

    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

Similar Threads

  1. Magic Eightball
    By sachmow in forum New To Java
    Replies: 1
    Last Post: 11-15-2009, 04:37 PM
  2. Jar files and a magic error.
    By dudejonne in forum Java Applets
    Replies: 2
    Last Post: 10-31-2009, 02:28 PM
  3. [SOLVED] Magic Points Game
    By jimmy7 in forum Java Applets
    Replies: 6
    Last Post: 04-26-2009, 11:40 PM
  4. Problem using buttons to creat a magic square game
    By goldman in forum New To Java
    Replies: 5
    Last Post: 05-05-2008, 04:04 AM
  5. Incompatible magic value 1008821359
    By willemjav in forum Java Applets
    Replies: 2
    Last Post: 03-21-2008, 09:41 AM

Posting Permissions

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