Advertisement
maus234

Untitled

Aug 27th, 2021
65
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.  
  14.             int numberOfAttempts = 3;
  15.             string password = "zavod";
  16.             string userInput;
  17.  
  18.             for (int i = 1; i <= numberOfAttempts; i++)
  19.             {
  20.                 Console.Write("Введите пароль:");
  21.                 userInput = Console.ReadLine();
  22.  
  23.                 if (userInput == password)
  24.                 {
  25.                     Console.WriteLine("Вам открыто секретное слова");
  26.                     Console.WriteLine("Иди работай бездельник");
  27.                 }
  28.                 else
  29.                 {
  30.                     Console.WriteLine("вы вели неправильны пароль, у вас осталось попыток" + " " + (numberOfAttempts - i));
  31.                 }
  32.                 if (i == numberOfAttempts)
  33.                 {
  34.                     break;
  35.                 }
  36.             }
  37.  
  38.         }
  39.  
  40.     }
  41. }    
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement