Stradjazz

Untitled

Jan 24th, 2017
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _03_English_Name_Of_Last_Digit
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int input = int.Parse(Console.ReadLine());
  14. string printNameOfDigit = GetLastDigit(input);
  15. Console.WriteLine(printNameOfDigit);
  16. }
  17. static string GetLastDigit(int input)
  18. {
  19. int lastDigit = input % 10;
  20. string nameOfDigit = "";
  21. switch (lastDigit)
  22. {
  23. case 0: nameOfDigit = "zero"; break;
  24. case 1: nameOfDigit = "one"; break;
  25. case 2: nameOfDigit = "two"; break;
  26. case 3: nameOfDigit = "three"; break;
  27. case 4: nameOfDigit = "four"; break;
  28. case 5: nameOfDigit = "five"; break;
  29. case 6: nameOfDigit = "six"; break;
  30. case 7: nameOfDigit = "seven"; break;
  31. case 8: nameOfDigit = "eight"; break;
  32. case 9: nameOfDigit = "nine"; break;
  33. }
  34. return nameOfDigit;
  35. }
  36.  
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment