stkirov

PrintCopyrightSymbol-Triangle

Sep 28th, 2012
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.94 KB | None | 0 0
  1. using System;
  2. using System.Text; //for displaing the copyright symbol
  3.  
  4. class Program
  5. {
  6.     static void Main(string[] args)
  7.     {
  8.         char copyRight = (char)169; //the copyright symbol
  9.         Console.OutputEncoding = Encoding.UTF8; //switch to UTF8 encoding
  10.         byte space = 3; //begin with 3 spaces
  11.         for (int i = 0; i < 3; i++)
  12.         {
  13.             //spaces on the left
  14.             for (int spacesLeft = 0; spacesLeft < space; spacesLeft++)
  15.             {
  16.                 Console.Write(" ");
  17.             }
  18.             //print the symbol
  19.             for (int printCR = 0; printCR <= i; printCR++)
  20.             {
  21.                 Console.Write(copyRight);
  22.             }
  23.             //spaces on the right
  24.             for (int spacesRight = 0; spacesRight < i; spacesRight++)
  25.             {
  26.                 Console.Write(copyRight);
  27.             }
  28.             Console.WriteLine();
  29.             space--;
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment