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