Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class digitName
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Please enter a number from 0 to 20:");
- int number;
- int.TryParse(Console.ReadLine(), out number);
- string switchOutput = "";
- switch (number)
- {
- case 0:
- switchOutput = "Zero";
- break;
- case 1:
- switchOutput = "One";
- break;
- case 2:
- switchOutput = "Two";
- break;
- case 3:
- switchOutput = "Three";
- break;
- case 4:
- switchOutput = "Four";
- break;
- case 5:
- switchOutput = "Five";
- break;
- case 6:
- switchOutput = "Six";
- break;
- case 7:
- switchOutput = "Seven";
- break;
- case 8:
- switchOutput = "Eight";
- break;
- case 9:
- switchOutput = "Nine";
- break;
- case 10:
- switchOutput = "Ten";
- break;
- case 11:
- switchOutput = "Eleven";
- break;
- case 12:
- switchOutput = "Twelve";
- break;
- case 13:
- switchOutput = "Thirteen";
- break;
- case 14:
- switchOutput = "Fourteen";
- break;
- case 15:
- switchOutput = "Fifteen";
- break;
- case 16:
- switchOutput = "Sixteen";
- break;
- case 17:
- switchOutput = "Seventeen";
- break;
- case 18:
- switchOutput = "Eighteen";
- break;
- case 19:
- switchOutput = "Nineteen";
- break;
- case 20:
- switchOutput = "Twenty";
- break;
- default:
- switchOutput = "Invalid Input! Please make sure you entered a right input value";
- break;
- }
- Console.WriteLine("The English name of the number {0} is: {1}", number, switchOutput);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement