kwest87

Untitled

Nov 1st, 2023
990
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.95 KB | None | 0 0
  1. [StartCode]
  2. using System;
  3.  
  4. namespace ConsoleApp27
  5. {
  6.     internal class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             int attempt = 3;
  11.             string password = "777";
  12.             string input;
  13.  
  14.             while (attempt>0)
  15.             {
  16.                 Console.WriteLine($"Введите пароль , попыток осталось : {attempt}");
  17.                 Console.Write("ПАРОЛЬ : ");
  18.                 input = Console.ReadLine();
  19.  
  20.                 if(password == input)
  21.                 {
  22.                     Console.WriteLine("Секретные данные");
  23.                     Console.ReadKey();
  24.                     continue;
  25.                 }
  26.                 else
  27.                 {
  28.                     Console.WriteLine("Пароль не верный");
  29.                     attempt--;
  30.                     Console.ReadKey();
  31.                 }
  32.             }
  33.         }
  34.     }
  35. }
  36. [EndCode]
Advertisement
Add Comment
Please, Sign In to add comment