W1thr

Пароль

Jan 30th, 2021 (edited)
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.84 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Homework12
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int tryCount = 3;
  14.             string password = "13or32ew";
  15.  
  16.             for (int i = tryCount; i > 0; i--)
  17.             {
  18.                 Console.Write($"У вас {i} попытки(а). Введите пароль:");
  19.                 string userInput = Console.ReadLine();
  20.  
  21.                 if (userInput == password)
  22.                 {
  23.                     Console.WriteLine("Пароль верен!");
  24.                     break;
  25.                 }
  26.                 else
  27.                 {
  28.                     Console.WriteLine("Неверно!");
  29.                 }
  30.             }
  31.  
  32.         }
  33.     }
  34. }
  35.  
Add Comment
Please, Sign In to add comment