Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class DigitToText
- {
- static void Main()
- {
- System.Console.WriteLine(DigitToString(123456789));
- }
- static string DigitToString(long value_to_convert)
- {
- long order_of_number = 10;
- string to_text = "";
- string[] text_nums = { "нуль", "один", "два", "три", "четыре", "пять", "шесть", "семь", "восемь", "девять" };
- while ((value_to_convert / (order_of_number / 10)) > 0)
- {
- to_text = to_text.Insert(0, text_nums[(value_to_convert % order_of_number) / (order_of_number / 10)] + " ");
- order_of_number *= 10;
- }
- return to_text;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment