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 passwordtask
- {
- class Program
- {
- static void Main(string[] args)
- {
- string password = "qwerty";
- string userInput;
- int tryCount = 3;
- for (int i = 0; i < tryCount; i++)
- {
- Console.Write("Введите пароль: ");
- userInput = Console.ReadLine();
- if (userInput == password)
- {
- Console.WriteLine("Верно! Секретное сообщение.");
- break;
- }
- else
- {
- Console.WriteLine($"Неверно! У вас осталось {tryCount - i - 1} попыток.");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement