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