This is a discussion on asking c code for magic square of 3*3 within the C and C++ forums, part of the Programming Talk category; sir, I want to ask the c code for 3*3 square matric code. and also the c code for * ** ** ** ** ***...
|
|||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I am giving the algorithm for generating magic square of size n*n where n is odd. You can substitute n=3 in your case.
* First start with one in the middle of the first row * Then traverse left and then go up and left. In these place numbers to empty squares in order of increasing. * If suppose you reached the first column then move to the last column of the same row and in the same manner for the first row move to the last row of the same column. * Proceed and if the square is filled already move down and continue till all is finished. Try this algorithm and let me know if you need any help. |
![]() |
| Thread Tools | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| comp.lang.c Answers (Abridged) to Frequently Asked Questions (FAQ) | Steve Summit | Tech FAQ | 0 | 06-01-2004 07:01 AM |
| comp.lang.c Answers to Frequently Asked Questions (FAQ List) | Steve Summit | Tech FAQ | 0 | 06-01-2004 07:00 AM |
| comp.cad.autocad AutoLISP FAQ (part 1/2) - general | Reini Urban | Tech FAQ | 0 | 06-01-2004 06:30 AM |
| Comp.software-eng FAQ (Part 0): periodic postings and archives | David Alex Lamb | Tech FAQ | 2 | 05-23-2004 06:15 AM |
| comp.cad.autocad AutoLISP FAQ (part 1/2) - general | Reini Urban | Tech FAQ | 0 | 05-01-2004 06:30 AM |