ranee

Untitled

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