ktopchiev

Number from 0 to 9 to text

Oct 24th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Numbers_by_words
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int num = int.Parse(Console.ReadLine());
  14.             string[] tonine = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" };
  15.             if (num >= 0 && num <= 9)
  16.             {
  17.                 Console.WriteLine(tonine[num]);
  18.             }
  19.             else if (num > 9)
  20.             {
  21.                 Console.WriteLine("number too big");
  22.             }
  23.         }
  24.     }
  25. }
Add Comment
Please, Sign In to add comment