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