Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace EnglishNameofTheLastDigit
- {
- class Program
- {
- static void Main(string[] args)
- {
- int num = int.Parse(Console.ReadLine()) % 10;
- string result = "";
- switch (num)
- {
- case 1:
- result = "one";
- break;
- case 2:
- result = "two";
- break;
- case 3:
- result = "three";
- break;
- case 4:
- result = "four";
- break;
- case 5:
- result = "five";
- break;
- case 6:
- result = "six";
- break;
- case 7:
- result = "seven";
- break;
- case 8:
- result = "eight";
- break;
- case 9:
- result = "nine";
- break;
- case 0:
- result = "zero";
- break;
- }
- Console.WriteLine(result);
- }
- }
- }
- Решение с масив:
- using System;
- namespace EnglishNameOfTheLastDigit
- {
- class Program
- {
- static void Main(string[] args)
- {
- int num = int.Parse(Console.ReadLine()) % 10;
- string[] result = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" };
- Console.WriteLine(result[num]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement