Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int distance = 0;
- int single = 0;
- int dec = 0;
- string text = "";
- string sEnd = " и ";
- Console.Write("Въведете разстояние в км: ");
- distance = int.Parse(Console.ReadLine());
- dec = distance / 10;
- single = distance - (dec * 10);
- if (dec != 0)
- {
- if (dec == 1)
- {
- switch (distance)
- {
- case 10: text = text + "десет";
- break;
- case 11: text = text + "единадесет";
- break;
- case 12:
- text = text + "дванадесет";
- break;
- case 13:
- text = text + "тринадесет";
- break;
- case 14:
- text = text + "четиринадесет";
- break;
- case 15:
- text = text + "петнадесет";
- break;
- case 16:
- text = text + "шестнадесет";
- break;
- case 17:
- text = text + "седемнадесет";
- break;
- case 18:
- text = text + "осемнадесет";
- break;
- case 19:
- text = text + "деветнадесет";
- break;
- default:
- break;
- }
- }
- else
- {
- switch (dec)
- {
- case 2: text = text + "двадесет";
- break;
- case 3: text = text + "тридесет";
- break;
- case 4:
- text = text + "четирдесет";
- break;
- case 5:
- text = text + "петдесет";
- break;
- case 6:
- text = text + "шестдесет";
- break;
- case 7:
- text = text + "седемдесет";
- break;
- case 8:
- text = text + "осемдесет";
- break;
- case 9:
- text = text + "деветдесет";
- break;
- default:
- break;
- }
- }
- }
- if (distance < 10 || distance > 20)
- {
- if (distance > 20 && single != 0)
- {
- text = text + sEnd;
- }
- switch (single)
- {
- case 1:
- text = text + "един";
- break;
- case 2:
- text = text + "два";
- break;
- case 3:
- text = text + "три";
- break;
- case 4:
- text = text + "четири";
- break;
- case 5:
- text = text + "пет";
- break;
- case 6:
- text = text + "шест";
- break;
- case 7:
- text = text + "седем";
- break;
- case 8:
- text = text + "осем";
- break;
- case 9:
- text = text + "девет";
- break;
- default:
- break;
- }
- }
- Console.WriteLine(text + " км");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement