Advertisement
braveheart1989

EngNameOfTheLastDigit

May 19th, 2016
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.27 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Numerics;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace _31.EngNameOfTheLastDigit
  9. {
  10.     class Program
  11.     {
  12.         static void Main()
  13.         {
  14.             try
  15.             {
  16.                 ulong num = ulong.Parse(Console.ReadLine());
  17.                 GetLastDigit(num);
  18.             }
  19.             catch (FormatException)
  20.             {
  21.                 Console.WriteLine("Error");
  22.             }
  23.         }
  24.  
  25.         static void GetLastDigit(ulong num)
  26.         {
  27.             ulong lastNum = (num % 10);
  28.             switch ((lastNum))
  29.             {
  30.                 case 0: Console.WriteLine("zero"); break;
  31.                 case 1: Console.WriteLine("one"); break;
  32.                 case 2: Console.WriteLine("two"); break;
  33.                 case 3: Console.WriteLine("three"); break;
  34.                 case 4: Console.WriteLine("four"); break;
  35.                 case 5: Console.WriteLine("five"); break;
  36.                 case 6: Console.WriteLine("six"); break;
  37.                 case 7: Console.WriteLine("seven"); break;
  38.                 case 8: Console.WriteLine("eight"); break;
  39.                 case 9: Console.WriteLine("nine"); break;
  40.             }
  41.            
  42.         }
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement