Advertisement
Rodunskiy

Untitled

Apr 9th, 2023
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.44 KB | None | 0 0
  1. string userInput;
  2. string cycleEnd = "exit";
  3. int repetitions = 1;
  4.  
  5.  
  6. while (repetitions > 0)
  7. {
  8.     Console.Write("Введите сообщение:");
  9.     userInput = Console.ReadLine();
  10.  
  11.     if (userInput == cycleEnd)
  12.     {
  13.         Console.WriteLine("Выход из цикла");
  14.         break;
  15.     }
  16.  
  17. Console.WriteLine(userInput);
  18. Console.WriteLine($"Если хотите закончить цикл введите {cycleEnd}.");
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement