Created
May 27, 2026 18:09
-
-
Save smah-beep/5088fa74a10f105cc56a1367a6c1ff8e to your computer and use it in GitHub Desktop.
ДЗ: Контроль выхода
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| namespace _DZ_ | |
| { | |
| internal class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| Random rand = new Random(); | |
| string stopWord = "exit"; | |
| string userWord; | |
| int composition; | |
| while (true) | |
| { | |
| int multiplier1 = rand.Next(1, 89), multiplier2 = rand.Next(3, 54); | |
| composition = multiplier1 * multiplier2; | |
| Console.WriteLine(composition); | |
| Console.WriteLine("Пока вы не напишете слово 'exit', программа будет перемножать разные числа между собой"); | |
| Console.Write("Введите слово: "); | |
| userWord = Console.ReadLine(); | |
| if (userWord == stopWord) | |
| { | |
| Console.WriteLine("Программа закончила свою работу и больше не будет перемножать числа"); | |
| break; | |
| } | |
| else if (userWord != stopWord) | |
| { | |
| Console.WriteLine("Слово введено неверно!"); | |
| } | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment