Advertisement
maus234

Untitled

Aug 28th, 2021
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.03 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.  
  17.             for (int i = 1; i <= numberOfAttempts; i++)
  18.             {
  19.                 Console.Write("Введите пароль:");
  20.                 userInput = Console.ReadLine();
  21.  
  22.                 if (userInput == password)
  23.                 {
  24.                     Console.WriteLine("Вам открыто секретное слова");
  25.                     Console.WriteLine("Иди работай бездельник");
  26.                 }
  27.                 else
  28.                 {
  29.                     Console.WriteLine("вы вели неправильны пароль, у вас осталось попыток" + " " + (numberOfAttempts - i));
  30.                 }
  31.             }
  32.  
  33.         }
  34.  
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement