Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp15
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- string password = "777";
- string userUnput;
- int remainingAttepts = 3;
- bool isWork = true;
- while (isWork)
- {
- Console.Write($"Введите правильно пароль , {remainingAttepts} попытки осталось: ");
- userUnput = Console.ReadLine();
- Console.WriteLine();
- remainingAttepts--;
- if (remainingAttepts > 0)
- {
- if (userUnput == password)
- {
- Console.WriteLine("Сообщение ...");
- isWork= false;
- }
- }
- else
- {
- Console.WriteLine("Лимит попыток исчерпан.");
- isWork = false;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment