Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Numerics;
- namespace EngNameLastDigit_14._05._2016
- {
- class Program
- {
- static void Main(string[] args)
- {
- string number = Console.ReadLine();
- int l = number.Length;
- char endDigit = number[l - 1];
- string nameEndDigit = String.Empty;
- LastDigitName(endDigit, nameEndDigit);
- }
- static void LastDigitName(int endDigit, string nameEndDigit)
- {
- Dictionary<int, string> digitNames = new Dictionary<int, string>();
- digitNames.Add( 49, "one");
- digitNames.Add( 50, "two");
- digitNames.Add( 51, "three");
- digitNames.Add( 52, "four");
- digitNames.Add( 53, "five");
- digitNames.Add( 54, "six");
- digitNames.Add( 55, "seven");
- digitNames.Add( 56, "eight");
- digitNames.Add( 57, "nine");
- digitNames.Add( 48, "zero");
- if (digitNames.TryGetValue(endDigit, out nameEndDigit))
- {
- Console.WriteLine("{0}", nameEndDigit);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement