Advertisement
pol9na

Untitled

Mar 1st, 2020
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.86 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Сprogect
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string password = "qwerty123";
  10.             string userPassword;
  11.             for (int numberOfAttempts = 0; numberOfAttempts < 3; numberOfAttempts++)
  12.             {
  13.             Console.WriteLine("Введите пароль");
  14.             userPassword = Console.ReadLine();
  15.            
  16.                 if (userPassword == password)
  17.                 {
  18.                     Console.WriteLine("Тайное сообщение");
  19.                     break;
  20.                 }
  21.                 else
  22.                 {
  23.                   Console.WriteLine("Пароль неверный. Введите пароль ещё раз");
  24.                  
  25.                 }
  26.                 }
  27.             Console.ReadKey();
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement