Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp
- {
- class Program
- {
- static void Main(string[] args)
- {
- string password = "кри_21";
- string userInput;
- int numberAttempts = 2;
- int completingAttempts = 0;
- Console.WriteLine("Для получения секрета введите пароль!");
- for (int i = numberAttempts; i >= completingAttempts; i--)
- {
- userInput = Console.ReadLine();
- if (userInput != password)
- {
- Console.WriteLine($"Пароль не верный. Осталось {i} попыток.");
- if (i == 0 )
- {
- Console.WriteLine("Пароль был - кри_21");
- }
- }
- else if (userInput == password)
- {
- Console.WriteLine("Доступ открыт. Секрет - бергамот - это сморщенный лимон");
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement