fk4m1913

Untitled

May 29th, 2020
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.35 KB | None | 0 0
  1. using System;
  2.  
  3. namespace EnglishNameOfTheLastDigit
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             //Input number and print last digit with words
  10.  
  11.             int number = int.Parse(Console.ReadLine());
  12.  
  13.             int digit = number % 10;
  14.  
  15.             switch (digit)
  16.             {
  17.                 case 0:
  18.                     Console.WriteLine("zero");
  19.                     break;
  20.                 case 1:
  21.                     Console.WriteLine("one");
  22.                     break;
  23.                 case 2:
  24.                     Console.WriteLine("two");
  25.                     break;
  26.                 case 3:
  27.                     Console.WriteLine("three");
  28.                     break;
  29.                 case 4:
  30.                     Console.WriteLine("four");
  31.                     break;
  32.                 case 5:
  33.                     Console.WriteLine("five");
  34.                     break;
  35.                 case 6:
  36.                     Console.WriteLine("six");
  37.                     break;
  38.                 case 7:
  39.                     Console.WriteLine("seven");
  40.                     break;
  41.                 case 8:
  42.                     Console.WriteLine("eight");
  43.                     break;
  44.                 case 9:
  45.                     Console.WriteLine("nine");
  46.                     break;
  47.             }
  48.         }
  49.     }
  50. }
Add Comment
Please, Sign In to add comment