Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace dz1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int attempts = 3;
- string password = "qwe123";
- string input;
- for (int i = 1; i <= attempts; i++)
- {
- Console.WriteLine("Введите пароль от секретного сообщения");
- input = Console.ReadLine();
- if (input == password)
- {
- Console.WriteLine("Секретное сообщение: кшупгкй8г4уп4у9лп");
- Console.ReadLine();
- }
- else
- {
- Console.WriteLine($"Пароль неверный, у вас осталось {attempts - i} попыток");
- }
- }
- Console.WriteLine("Попытки закончились, аварийное закрытие.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement