using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApp3 { public partial class Form1 : Form { public Form1() { InitializeComponent(); textBox1.TextChanged += textBox1_TextChanged; } private void textBox1_TextChanged(object sender, EventArgs ee) { string res; string[] ed = new string[10] { " ","один", "два", "три", "четыре", "пять", "шесть", "семь", "восемь", "девять" }; string[] des = new string[10] { " ","десять","двадцать","тридцать","сорок","пятьдесят","шестьдесят","семьдесят","восемьдесят","девяносто" }; string[] sot = new string[10] { " ", "сто", "двести", "триста", "четыреста", "пятьсот", "шестьсот", "семьсот", "восемьсот", "девятьсот" }; string[] iskl = new string[10] { " ", "одинадцать","двенадцать","тринадцать","четырнадцать","пятнадцать","шестнадцать","семнадцать","восемьнадцать","девятнадцать" }; int x; if ((int.TryParse(textBox1.Text, out x)) && (x >= 0) && (x <= 1000)) { if (x == 1000) res = "тысяча"; else if (x == 0) res = "ноль"; else { int s = x / 100; x= x % 100; res = sot[s]; int d = x / 10; int e = x % 10; if ((d == 1) && (e != 0)) res = res + " " + iskl[e]; else res = res + " " + des[d] + " " + ed[e]; } label1.Text = res; } else label1.Text=""; } } }