Advertisement
Guest User

Untitled

a guest
Oct 29th, 2015
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.43 KB | None | 0 0
  1. using System;
  2. class PrintSequence
  3. {
  4.     static void Main()
  5.     {
  6.         for (int i = 2; i <= 11; i++)
  7.             if (i % 2 == 0)
  8.             {
  9.                 if (i == 2)  //This "if" will remove the comma before the first number.
  10.                     Console.Write(i);
  11.                 else
  12.  
  13.                     Console.Write("," + i);
  14.             }
  15.  
  16.             else
  17.                 Console.Write("," + (-i));
  18.  
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement