Advertisement
Teodor92

DigitName

Oct 30th, 2012
572
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.18 KB | None | 0 0
  1. /* Write program that asks for a digit and depending on
  2.  * the input shows the name of that digit (in English) using a switch statement.
  3.  */
  4. using System;
  5.  
  6. class DigitName
  7. {
  8.     static void Main()
  9.     {
  10.         Console.WriteLine("Enter a digit please:");
  11.         sbyte digit = sbyte.Parse(Console.ReadLine());
  12.         switch (digit)
  13.         {
  14.             case 1: Console.WriteLine("One");
  15.                 break;
  16.             case 2: Console.WriteLine("Two");
  17.                 break;
  18.             case 3: Console.WriteLine("Three");
  19.                 break;
  20.             case 4: Console.WriteLine("Four");
  21.                 break;
  22.             case 5: Console.WriteLine("Five");
  23.                 break;
  24.             case 6: Console.WriteLine("Six");
  25.                 break;
  26.             case 7: Console.WriteLine("Seven");
  27.                 break;
  28.             case 8: Console.WriteLine("Eight");
  29.                 break;
  30.             case 9: Console.WriteLine("Nine");
  31.                 break;
  32.             case 0: Console.WriteLine("Zero");
  33.                 break;
  34.             default: Console.WriteLine("Huston we have a problem !");
  35.                 break;
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement