I need help using modulus equations to print different column patterns in a 2 dimensional array (of an unspecified row and column). The final output should look similar to this:
https://i.ibb.co/QQ3LcCW/2d-Array-Pattern.png
I already know how to loop through the 2d-array with two for-loops. And in order to get the final column (1,0,1,0, etc..) pattern i need to use the modulus equation: (n % 2) where n is the row # (starting at 1). For the other columns i'm not sure which modulus equations to use (would appreciate any hints or references i can look up).
Aucun commentaire:
Enregistrer un commentaire