kwest87

Untitled

Mar 23rd, 2022
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.85 KB | None | 0 0
  1. [StartCode]
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace ConsoleApp8
  9. {
  10.     internal class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             string password = "pass";
  15.             string tryPassword;
  16.             int tryCount = 3;
  17.  
  18.             for (int i = 0; i < tryCount; i++)
  19.             {
  20.                 Console.Write("Введите пароль : ");
  21.                 tryPassword = Console.ReadLine();
  22.  
  23.                 if (password != tryPassword)
  24.                 {
  25.                     Console.WriteLine("Пароль не верный.");
  26.                 }
  27.  
  28.                 else
  29.                 {
  30.                     Console.WriteLine("Доступ открыт");
  31.                 }
  32.             }
  33.         }
  34.     }
  35. }
  36. [EndCode]
Advertisement
Add Comment
Please, Sign In to add comment