Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Hw14
- {
- class Program
- {
- static void Main()
- {
- string password = "qwerty";
- int totalAttepmtsToEnterPassword = 3;
- int remainingNumberOfAttempts = 3;
- string userInputOfPassword;
- for (int i = 0; i < totalAttepmtsToEnterPassword; i++)
- {
- Console.Write("Введите пароль: ");
- userInputOfPassword = Console.ReadLine();
- if (userInputOfPassword == password)
- {
- Console.WriteLine("Секретное сообщение");
- break;
- }
- else
- {
- remainingNumberOfAttempts--;
- Console.WriteLine($"Пароль введен неверно. Осталось попыток для ввода: {remainingNumberOfAttempts}\n");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement