LusienGG

[C#] English Name Of The Last Digit

May 25th, 2016
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.81 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Practice
  4. {
  5.     class Practice
  6.     {
  7.         static void Main()
  8.         {
  9.             int num = int.Parse(Console.ReadLine());
  10.             string word = LastDigit(num);
  11.             Console.WriteLine(word);
  12.         }
  13.         static string LastDigit(int n)
  14.         {
  15.             int tmp = n % 10;
  16.             switch (tmp)
  17.             {
  18.                 case 1: return "one";
  19.                 case 2: return "two";
  20.                 case 3: return "three";
  21.                 case 4: return "four";
  22.                 case 5: return "five";
  23.                 case 6: return "six";
  24.                 case 7: return "seven";
  25.                 case 8: return "eight";
  26.                 case 9: return "nine";
  27.                 default:
  28.                     return "zero";
  29.             }
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment