Advertisement
YavorGrancharov

English_Name_of_Last_Digit

Oct 4th, 2017
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.57 KB | None | 0 0
  1. using System;
  2.  
  3. namespace English_Name_of_Last_Digit
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string input = Console.ReadLine();
  10.             LastLetterAsDigit(input);
  11.         }
  12.         public static void LastLetterAsDigit(string input)
  13.         {
  14.             string last = input.Substring(input.Length - 1,1);
  15.             int output = Convert.ToInt32(last);
  16.             switch (output)
  17.             {
  18.                 case 0:
  19.                     Console.WriteLine("zero");
  20.                     break;
  21.                 case 1:
  22.                     Console.WriteLine("one");
  23.                     break;
  24.                 case 2:
  25.                     Console.WriteLine("two");
  26.                     break;
  27.                 case 3:
  28.                     Console.WriteLine("three");
  29.                     break;
  30.                 case 4:
  31.                     Console.WriteLine("four");
  32.                     break;
  33.                 case 5:
  34.                     Console.WriteLine("five");
  35.                     break;
  36.                 case 6:
  37.                     Console.WriteLine("six");
  38.                     break;
  39.                 case 7:
  40.                     Console.WriteLine("seven");
  41.                     break;
  42.                 case 8:
  43.                     Console.WriteLine("eight");
  44.                     break;
  45.                 case 9:
  46.                     Console.WriteLine("nine");
  47.                     break;
  48.                 default:
  49.                     Console.WriteLine("");
  50.                     break;
  51.             }
  52.         }
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement