Advertisement
Guest User

PrintLongSequence

a guest
Jan 19th, 2015
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.50 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4. namespace App1
  5. {
  6.     class PrintLongSequence
  7.     {
  8.         static void Main()
  9.         {
  10.             for (short i = 2; i <= 1001; i++)
  11.             {
  12.                 bool isMaxVal = (i != 1001);
  13.                 if (i % 2 == 0)
  14.                 {
  15.                     Console.Write(i + ",");
  16.                 }
  17.                 else
  18.                 {
  19.                     Console.Write(((-1) * i) + ((isMaxVal) ? "," : "\n"));
  20.                 };
  21.  
  22.             }
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement