Advertisement
stefkay

PrintSequence

Aug 25th, 2015
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.39 KB | None | 0 0
  1. using System;
  2.  
  3. class PrintSequence
  4. {
  5.     static void Main()
  6.     {
  7.         for (int i = 2; i <= 11; i++)
  8.         {
  9.             if (i % 2 == 0) //if i is even print i
  10.             {
  11.                 Console.Write(i + ",");
  12.             }
  13.             else //if i is odd print its negative value
  14.             {
  15.                 Console.Write(i * (-1) + ",");
  16.             }
  17.         }    
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement