Facebook
From JohnSteel, 2 Years ago, written in C#.
Embed
Download Paste or View Raw
Hits: 443
  1. using System;
  2.  
  3. namespace _02._English_Name_of_the_Last_Di
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int number = int.Parse(Console.ReadLine());
  10.  
  11.             int lastDigit = number % 10;
  12.  
  13.             string digitName = lastDigit == 1 ? "one" :
  14.                 lastDigit == 2 ? "two" :
  15.                 lastDigit == 3 ? "three" :
  16.                 lastDigit == 4 ? "four" :
  17.                 lastDigit == 5 ? "five" :
  18.                 lastDigit == 6 ? "six" :
  19.                 lastDigit == 7 ? "seven" :
  20.                 lastDigit == 8 ? "eight" :
  21.                 lastDigit == 9 ? "nine" : "zero";
  22.  
  23.             Console.WriteLine(digitName);
  24.  
  25.         }
  26.     }
  27. }
  28.