kwest87

Untitled

Dec 28th, 2023
703
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.06 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp15
  4. {
  5.     internal class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string password = "777";
  10.             string userUnput;
  11.             int remainingAttepts = 3;
  12.             bool isWork = true;
  13.  
  14.             while (isWork)
  15.             {
  16.                 Console.Write($"Введите правильно пароль , {remainingAttepts} попытки осталось: ");
  17.                 userUnput = Console.ReadLine();
  18.                 Console.WriteLine();
  19.                 remainingAttepts--;
  20.  
  21.                 if (remainingAttepts > 0)
  22.                 {
  23.                     if (userUnput == password)
  24.                     {
  25.                         Console.WriteLine("Сообщение ...");
  26.                         isWork= false;
  27.                     }
  28.                 }
  29.                 else
  30.                 {
  31.                     Console.WriteLine("Лимит попыток исчерпан.");
  32.                     isWork = false;
  33.                 }
  34.             }
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment