The seconds loop goes till 100... your array has only 12 positions, it will give a crash if you try to print it there. Basically cause you're trying to access a memory region that does not belong to your program.
:S you don't have a 100 matrix.. you have a array with 12 positions. The second loop is only setting the values on your array using some (weird) math.
PS: Don't just copy&paste those codes. You'll end up like this all the time... without understanding what the code does. Try to do them by yourself Get a book, read it