jrliv
12/30/2016 - 2:05 PM

Prints the first 100 members of the sequence 2, -3, 4, -5, 6, -7, 8...

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();