C# – Creating a Matrix – Video

I have just made my first YouTube video!In it I create a matrix and I fill it up, using different directions. The size of the matrix is read from the Console. Or with other words, if the number is 5, then the following matrix is printed:

 1

16

15

14

13

 2

17

24

23

12

 3

18

25

22

11

 4

19

20

21

10

 5

 6

 7

 8

 9

 


It is quite easy to be done, one should just be careful to create four directions and to take care of the length of the rows. Another clever moment is to make everything in a loop, which is exactly the square of the entered number. So, as promised in the YouTube video, here you may find the code:

 

If you do not have C# .Net or you just want to see the code working, download the exe file from here. It would probably inform you that the file can be dangerous and it would be a good warning! In general you should avoid downloading & running *.exe files from the internet.

So, if you know me in person or you trust me, you can download the file. Otherwise, install .Net, copy the code and run the application by yourself.

 

About

VBA Developer