Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp5
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Программа выводит поочередно числа до тех пор, пока вы не напишите ключевое слово < exit >");
- int attemptСounter = 0;
- string exit = "exit";
- string userInput;
- bool able = true;
- while (able)
- {
- Console.WriteLine("Введите ключевое слово: ");
- userInput = Console.ReadLine();
- if (exit == userInput)
- {
- Console.WriteLine("Вы вышли из цикла");
- break;
- }
- else
- {
- Console.WriteLine("Продолжаем считать...");
- attemptСounter++;
- Console.WriteLine(attemptСounter);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement