Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- class Program
- {
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- string name = englishName(n);
- Console.WriteLine(name);
- }
- private static string englishName(int num)
- {
- string lastDigit = "";
- int lastNumber = num % 10;
- switch (lastNumber)
- {
- case 0:
- lastDigit = "zero";
- break;
- 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;
- default:
- break;
- }//end of switch
- return lastDigit;
- }//end of englishName
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement