kwest87

Untitled

Nov 3rd, 2023
842
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.98 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.             for (int i = 0; i < attempt;)
  15.             {
  16.                 Console.Clear();
  17.                 Console.WriteLine($"Введите пароль , попыток осталось : {attempt}");
  18.                 Console.Write("ПАРОЛЬ : ");
  19.                 input = Console.ReadLine();
  20.  
  21.                 if(password == input)
  22.                 {
  23.                     Console.WriteLine("Секретные данные");
  24.                     break;
  25.                 }
  26.                 else
  27.                 {
  28.                     Console.WriteLine("Пароль не верный");
  29.                     Console.ReadKey();
  30.                     attempt--;
  31.                     continue;
  32.                 }
  33.             }
  34.         }
  35.     }
  36. }
  37. [EndCode]
Advertisement
Add Comment
Please, Sign In to add comment