Advertisement
Guest User

Untitled

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