Advertisement
Blagovest

EnglishNameOfLastDigit

Oct 9th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 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 Hello_Name_
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. long number = Math.Abs(long.Parse(Console.ReadLine()));
  14. Console.WriteLine(PrintInEnglish(number));
  15. }
  16. static string PrintInEnglish(long number)
  17. {
  18. long LastDigit = number % 10;
  19. string nameOfDigit;
  20. if (LastDigit==0)
  21. {
  22. nameOfDigit = ("zero");
  23. }
  24. else if (LastDigit==1)
  25. {
  26. nameOfDigit =("one");
  27. }
  28. else if (LastDigit==2)
  29. {
  30. nameOfDigit = ("two");
  31. }
  32. else if (LastDigit == 3)
  33. {
  34. nameOfDigit = ("three");
  35. }
  36. else if (LastDigit == 4)
  37. {
  38. nameOfDigit = ("four");
  39. }
  40. else if (LastDigit == 5)
  41. {
  42. nameOfDigit = ("five");
  43. }
  44. else if (LastDigit == 6)
  45. {
  46. nameOfDigit = ("six");
  47. }
  48. else if (LastDigit == 7)
  49. {
  50. nameOfDigit=("seven");
  51. }
  52. else if (LastDigit == 8)
  53. {
  54. nameOfDigit=("eight");
  55. }
  56. else
  57. {
  58. nameOfDigit=("nine");
  59. }
  60. return nameOfDigit;
  61. }
  62. }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement