Advertisement
pol9na

Untitled

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