Advertisement
milen8204

Problem 14.* Print the ASCII Table

Mar 13th, 2014
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.99 KB | None | 0 0
  1. using System;
  2. using System.Text;
  3. /* Find online more information about ASCII (American Standard Code for Information Interchange)
  4.  * and write a program to prints the entire ASCII table of characters at the console (characters from 0 to 255).
  5.  * Note that some characters have a special purpose and will not be displayed as expected. You may skip them or display them differently.
  6.  * You may need to use for-loops (learn in Internet how). */
  7. class PrintASCIITable
  8. {
  9.    
  10.     static void Main()
  11.     {
  12.         Console.OutputEncoding = Encoding.UTF8;
  13.         Console.WriteLine("-----------------------------------------");
  14.         Console.WriteLine("|Dec.\t|Hex.\t\t|Uni\t\t|");
  15.         Console.WriteLine("-----------------------------------------");
  16.        
  17.         for (int i = 0; i <= 255; i++)
  18.         {
  19.             Console.WriteLine("|{0}\t|{1}\t\t|{2}\t\t|",i, i.ToString("X"), (char)i);
  20.             Console.WriteLine("-----------------------------------------");
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement