Last active
August 29, 2015 14:16
-
-
Save CodyEngel/3591132fff4998d904e6 to your computer and use it in GitHub Desktop.
Set Duplicate Items to 0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int[] array = {2, 3, 5, 5, 7, 11, 11, 11, 13}; | |
int originalNumber = array[0]; | |
for (int i = 1; i < array.Length; i++) | |
{ | |
if (array[i] == originalNumber) | |
{ | |
array[i] = 0; | |
} | |
else | |
{ | |
originalNumber = array[i]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment