Advertisement
adriyanbulgary

Untitled

May 29th, 2014
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.40 KB | None | 0 0
  1. using System;
  2. /*
  3.  * Write a program that prints the first 10 members of the sequence: 2, -3, 4, -5, 6, -7, ...
  4.  */
  5. class PrintSequence
  6. {
  7.     static void Main()
  8.     {
  9.         for ( int i = 2 ; i < 12 ; i++ )
  10.         {
  11.             if ( i % 2 == 0 )
  12.             {
  13.                 Console.WriteLine(i);
  14.                 continue;
  15.             }
  16.             Console.WriteLine(-i);
  17.         }
  18.  
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement