Advertisement
Briotar

Untitled

May 1st, 2021
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.77 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Pravki
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string password = "somesecretkey";
  10.             string userInput = "";
  11.             int countTry = 3;
  12.  
  13.             for(int i = 0; i < countTry; i++)
  14.             {
  15.                 Console.WriteLine("Введите пароль:");
  16.                 userInput = Console.ReadLine();
  17.                 if (userInput == password)
  18.                 {
  19.                     Console.WriteLine("somesecretmessadge");
  20.                     break;
  21.                 }
  22.                 else
  23.                 {
  24.                     Console.WriteLine($"У вас осталось {countTry - i - 1} попыток");
  25.                 }
  26.             }
  27.  
  28.         }
  29.     }
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement