Adding upto 15 | Ciena inetrview

How can you place the numbers 1 through 9 in a 3×3 grid such that every row, column, and the two diagonals all add up to 15?

 

 

 

 

Solution:

It first seems logical to put the 5 in the middle square becuase it is the median 
and mean of the numbers from 1 to 9 (and also the average of any 3 numbers adding 
up to 15).
The next thing to do is place the 1 since it's the smallest and will thus be 
likely to quickly constrain what we can do afterward. We can try to place the 1 
in either a side square or a corner square, but once we place it, it forces us 
to place the 9 on the opposite side. At this point, we just play around 
with the remaining numbers to see if we can work out a solution

Leave a Reply

Your email address will not be published. Required fields are marked *

For Inserting code :
Paste your code in the comment form, select it and then click the language link

C | C++ | Java |

*