Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace _1000DaysAfterBirth
- {
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- public class Program
- {
- public static void Main()
- {
- int numberInput = int.Parse(Console.ReadLine());
- string[] firstNineteenNumbers = new string[]
- {
- "Zero",
- "One",
- "Two",
- "Three",
- "Four",
- "Five",
- "Six",
- "Seven",
- "Eight",
- "Nine",
- "Ten",
- "Eleven",
- "Twelve",
- "Thirteen",
- "Fourteen",
- "Fifteen",
- "Sixteen",
- "Seventeen",
- "Eighteen",
- "Nineteen"
- };
- string result = string.Empty;
- if (numberInput >= 0 && numberInput <= 19)
- {
- result = firstNineteenNumbers[numberInput];
- }
- else if (numberInput >= 20 && numberInput < 100)
- {
- string[] tens = new string[] { "Twenty ", "Thirty ", "Forty ", "Fifty ", "Sixty ", "Seventy ", "Eighty ", "Ninety " };
- string secondNumber = numberInput % 10 == 0 ? string.Empty : firstNineteenNumbers[numberInput % 10];
- result = (tens[numberInput / 10 - 2] + secondNumber);
- }
- else if (numberInput == 100)
- {
- result = "one hundred";
- }
- Console.WriteLine(result.TrimEnd());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement