Advertisement
TanyaPetkova

C# Part I Intro Exercise 9

Nov 1st, 2013
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.49 KB | None | 0 0
  1. using System;
  2.  
  3. class Progression
  4. {
  5.     static void Main()
  6.     {
  7.         short counter = 0;
  8.         short term = 2;
  9.         while (counter<10)
  10.         {
  11.             if (term % 2 == 0)
  12.             {
  13.                 Console.Write(term + ", ");
  14.             }
  15.             else
  16.             {
  17.                 Console.Write(-term + ", ");
  18.             }
  19.             term++;
  20.             counter++;
  21.         }
  22.         Console.Write("\b" + "\b" + " ");
  23.         Console.WriteLine();
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement