Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void Main(string[] args)
- {
- int x = int.Parse(Console.ReadLine());
- if ((x > 100) || (x < 0))
- {
- Console.WriteLine("invalid number");
- return;
- }
- string[] toNineteen = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten",
- "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"};
- string[] toNinety = { "twenty", "thirty", "fourty", "fifty", "sixty", "seventy", "eighty", "ninety", "one hundred" };
- if (x < 20)
- {
- Console.WriteLine(toNineteen[x]);
- }
- else
- {
- Console.WriteLine(toNinety[x / 10 - 2] + (x % 10 > 0 ? " " + toNineteen[x % 10] : ""));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement