Skip to content

Instantly share code, notes, and snippets.

@Brianceasar
Last active November 30, 2022 06:30
Show Gist options
  • Save Brianceasar/76a7f696d9f4523626783186375748d4 to your computer and use it in GitHub Desktop.
Save Brianceasar/76a7f696d9f4523626783186375748d4 to your computer and use it in GitHub Desktop.
Program that prints the first 100 members of the sequence 2, -3, 4, -5, 6, -7, 8...
for (int i = 2; i < 101; i++)
{
if (i % 2 == 0)
{
Console.Write("{0} ", i);
}
else
{
Console.Write("{0} ", -i);
}
}
Console.WriteLine();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment