Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Problem 1725. Diagonal & Anti-Diagonal Matrix: Easy

Created by Suman Saha

Create a matrix as shown below from "magic" square.

For example:

if input x=9;then use mgic(x) and create the matrix below:
    47     0     0     0     0     0     0     0    45
     0    68     0     0     0     0     0    44     0
     0     0     8     0     0     0    43     0     0
     0     0     0    20     0    42     0     0     0
     0     0     0     0    82     0     0     0     0
     0     0     0    40     0    62     0     0     0
     0     0    39     0     0     0    74     0     0
     0    38     0     0     0     0     0    14     0
    37     0     0     0     0     0     0     0    35
if input x=3;then use mgic(x) and create the matrix below:
     8     0     6
     0    10     0
     4     0     2

Tags

Problem Group

Solution Statistics

29 correct solutions 19 incorrect solutions
Last solution submitted on Jun 07, 2014

Problem Comments