Advertisement
OleJkeen

HomeWork password

Mar 28th, 2023
903
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.68 KB | None | 0 0
  1.             int tryCount = 3;
  2.             string userPassword = "12345";
  3.             string userInput;
  4.            
  5.             for(int i = 0; i < tryCount; i++)
  6.             {
  7.                 Console.WriteLine("Введите пароль: ");
  8.                 userInput = Console.ReadLine();
  9.  
  10.                 if (userPassword == userInput)
  11.                 {
  12.                     Console.WriteLine("Секретная информация");
  13.                     break;
  14.                 }
  15.                 else
  16.                 {
  17.                     Console.WriteLine("Введите пароль еще раз: ");
  18.                 }
  19.             }
  20.             Console.ReadLine();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement