Saturday, October 15, 2011

Computer Programing 1

A computer program was made here by Ady which is able to beep as many times as you decide, say: Hello World From Ady and design a magic square. Here is the code:

A=magic(3);
for i = 1: 2
beep;
fprintf('hello world from ady\n');
end

See if you can figure out the magic part of magic square it genrates.

octave-3.2.4.exe:66> ady
hello world from ady
hello world from ady
ans =

8 3 4
1 5 9
6 7 2

No comments:

Post a Comment