Advertisement
cortez

Print_Sequence

Aug 27th, 2015
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.36 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Problem_9__PrintSequence
  4. {
  5.     class PrintSequence
  6.     {
  7.         public static void Main ()
  8.         {
  9.             int len = 12;
  10.             string output = "";
  11.  
  12.             for (int i = 2; i < len; i++)
  13.             {
  14.                 int num = (i % 2 == 0) ? i : (i * (-1));
  15.                 output += (i != (len - 1)) ? num + ", ": num.ToString();
  16.             }
  17.             Console.WriteLine ("{0}", output);
  18.         }
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement