Skip to content

Instantly share code, notes, and snippets.

@lgolubyev
Created May 23, 2022 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lgolubyev/6f69856f3bb135cdfbec1d931bb9b0f0 to your computer and use it in GitHub Desktop.
Save lgolubyev/6f69856f3bb135cdfbec1d931bb9b0f0 to your computer and use it in GitHub Desktop.
private static int SumOdd(int[] array)
{
int counter = 0;
for (int i = 0; i < array.Length; i++)
{
var element = array[i];
if ((element & 1) == 1)
counter += element;
}
return counter;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment