Advertisement
Guest User

English name of last digit

a guest
Jan 24th, 2017
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 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.englishNameOfLastDigit
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. var number = long.Parse(Console.ReadLine());
  14. string name = number.ToString();
  15. string result = name[name.Length - 1].ToString();
  16. string whatToPrint = ReturnNames(result);
  17. Console.WriteLine(whatToPrint);
  18. }
  19.  
  20. public static string ReturnNames(string number)
  21. {
  22. string itsName = "";
  23. if (string.Equals(number, "1") || string.Equals(number, "-1"))
  24. {
  25. itsName = "one";
  26. }
  27. else if (string.Equals(number, "2") || string.Equals(number, "-2"))
  28. {
  29. itsName = "two";
  30. }
  31. else if (string.Equals(number, "3") || string.Equals(number, "-3"))
  32. {
  33. itsName = "three";
  34. }
  35. else if (string.Equals(number, "4") || string.Equals(number, "-4"))
  36. {
  37. itsName = "four";
  38. }
  39. else if (string.Equals(number, "5") || string.Equals(number, "-5"))
  40. {
  41. itsName = "five";
  42. }
  43. else if (string.Equals(number, "6") || string.Equals(number, "-6"))
  44. {
  45. itsName = "six";
  46.  
  47. }
  48. else if (string.Equals(number, "7") || string.Equals(number, "-7"))
  49. {
  50. itsName = "seven";
  51. }
  52. else if (string.Equals(number, "8") || string.Equals(number, "-8"))
  53. {
  54. itsName = "eight";
  55. }
  56. else if (string.Equals(number, "9") || string.Equals(number, "-9"))
  57. {
  58. itsName = "nine";
  59. }
  60. else if (string.Equals(number, "0"))
  61. {
  62. itsName = "null";
  63. }
  64. else
  65. {
  66. itsName = "wrong";
  67. }
  68. return itsName;
  69. }
  70. }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement