Advertisement
asvd32

13

Feb 15th, 2025
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.81 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp3
  4. {
  5.     internal class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string sicretMassage = "секрет!";
  10.             string pass = "asdf123";
  11.             int contOfTry = 3;
  12.             int index;
  13.             string userPass = "";
  14.  
  15.             for (index = 0; index < contOfTry; index++)
  16.             {
  17.                 Console.Write($"Введите пароль: ");
  18.                 userPass = Console.ReadLine();
  19.  
  20.                 if (userPass == pass)
  21.                 {
  22.                     Console.WriteLine(sicretMassage);
  23.                     break;
  24.                 }
  25.                 else
  26.                 {
  27.                     Console.WriteLine("Неверный пароль!");
  28.                 }
  29.             }
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement