Exforsys

Online Training

asking c code for magic square of 3*3

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 * ** ** ** ** ***...


Go Back   Exforsys > Programming Talk > C and C++

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-14-2007, 09:28 AM
Junior Member
 
Join Date: Aug 2007
Posts: 1
jagdish pimoli is on a distinguished road
asking c code for magic square of 3*3

sir, I want to ask the c code for 3*3 square matric code.
and also the c code for



*
**
**
**
**
***
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 10-20-2008, 04:31 PM
Member
 
Join Date: Apr 2006
Posts: 65
priyaraji is on a distinguished road
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

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


All times are GMT -4. The time now is 09:14 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2004 - 2007 Exforsys Inc. All rights reserved.