Advertisement
maus234

Untitled

Aug 27th, 2021
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.14 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 Leson01
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int numberOfAttempts = 3;
  14.             string password = "zavod";
  15.             string userInput;
  16.             for (int i = 1; i <= numberOfAttempts; i++)
  17.             {
  18.                 Console.Write("Введите пароль:");
  19.                 userInput = Console.ReadLine();
  20.  
  21.                 if (userInput == password)
  22.                 {
  23.                     Console.WriteLine("Вам открыто секретное слова");
  24.                     Console.WriteLine("Иди работай бездельник");
  25.                 }
  26.                 else
  27.                 {
  28.                     Console.WriteLine("вы вели неправильны пароль, у вас осталось попыток" + " " + (numberOfAttempts - i));
  29.                 }
  30.                 if (i == numberOfAttempts)
  31.                 {
  32.                     break;
  33.                 }
  34.             }
  35.  
  36.         }
  37.  
  38.     }
  39. }    
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement