I am looking to create a program like the following (c# btw):
int[] arr = new int[9]
//some code that puts values 1, 0, or 2 in each array element
for(int i
Use the modulo operator like this:
if (arr[i] == arr[(i + 3) % arr.Length]) { return true; }
You could try the following expression inside your if
statement.
arr[i] == arr[(i + 3) % arr.Length];
The % Operator
Divides the value of one expression by the value of another, and returns the remainder.