Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- internal class Program
- {
- static void Main(string[] args)
- {
- int triesCount = 3;
- int triesRemained = triesCount;
- string pasword = "пароль";
- string userInput;
- for (int i = 0; i < triesCount; i++)
- {
- Console.Write("Введите пароль: ");
- userInput = Console.ReadLine();
- if (userInput == pasword)
- {
- Console.WriteLine("Пароль верный!");
- break;
- }
- else
- {
- triesRemained--;
- Console.WriteLine("Пароль не верный!\nУ вас осталось попыток - " + triesRemained);
- }
- }
- Console.ReadKey();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement