syssboxx

PrintIsocelesTriangle

May 29th, 2013
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.89 KB | None | 0 0
  1. //Write a program that prints an isosceles triangle of 9 copyright symbols ©.
  2. //Use Windows Character Map to find the Unicode code of the © symbol.
  3. //Note: the © symbol may be displayed incorrectly.
  4.  
  5. using System;
  6.  
  7. class PrintIsocelesTraingle
  8. {
  9.     static void Main()
  10.     {
  11.        Console.OutputEncoding = System.Text.Encoding.UTF8;
  12.        char copyright='\u00A9';
  13.        int numberRows = 3;
  14.        
  15.        Console.WriteLine();
  16.  
  17.        for (int rows = 0; rows < numberRows; rows++)
  18.        {
  19.            for (int spaceCounter = numberRows-rows-1; spaceCounter>=0; spaceCounter--)
  20.            {
  21.                Console.Write(" ");
  22.            }
  23.            for (int elementsCounter = 0; elementsCounter <= (2 * rows); elementsCounter++)
  24.            {
  25.                Console.Write(copyright);
  26.            }
  27.            Console.WriteLine();
  28.  
  29.        }
  30.  
  31.        Console.WriteLine();
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment