Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class Program
- {
- public static void Main()
- {
- string num = Console.ReadLine();
- char lastDigit = num[num.Length - 1];
- PrintLastDigit(lastDigit);
- }
- static void PrintLastDigit(char lastDigit)
- {
- switch (lastDigit)
- {
- case '1':
- Console.WriteLine("one");
- break;
- case '2':
- Console.WriteLine("two");
- break;
- case '3':
- Console.WriteLine("three");
- break;
- case '4':
- Console.WriteLine("four");
- break;
- case '5':
- Console.WriteLine("five");
- break;
- case '6':
- Console.WriteLine("six");
- break;
- case '7':
- Console.WriteLine("seven");
- break;
- case '8':
- Console.WriteLine("eight");
- break;
- case '9':
- Console.WriteLine("nine");
- break;
- case '0':
- Console.WriteLine("zero");
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement