Advertisement
bacco

English Name of Last Digit

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