Advertisement
SPavelA

Untitled

Aug 24th, 2023 (edited)
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.90 KB | None | 0 0
  1.             String password = "12345";
  2.             String inputPassword;
  3.             String secretMessage = "Поздравляем, вам очень сильно повезет в этой жизни!";
  4.             int tryCount = 3;
  5.  
  6.             for (int i = 0; i < tryCount; i++)
  7.             {
  8.                 Console.Write("Введите пароль: ");
  9.                 inputPassword = Console.ReadLine();
  10.  
  11.                 if (inputPassword == password)
  12.                 {
  13.                     Console.WriteLine("Вы угадали пароль!");
  14.                     Console.WriteLine(secretMessage);
  15.                     break;
  16.                 }
  17.                 else
  18.                 {
  19.                     Console.WriteLine("Вы не угадали пароль!");
  20.                 }
  21.             }
  22.  
  23.             Console.WriteLine("До свидания!");
  24.             Console.ReadKey();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement