Last active
October 18, 2022 12:33
-
-
Save Velsimir/a83e8b8510ba892f705dfa0309250f61 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Security.Policy; | |
namespace iJunior | |
{ | |
class MainClass | |
{ | |
public static void Main(string[] args) | |
{ | |
string password = "qwerty1234"; | |
string userInput; | |
string secretSword = "Secret Sword"; | |
int countMax = 3; | |
for (int i = 1; i <= countMax; i++) | |
{ | |
Console.Write("Введите пароль: "); | |
userInput = Console.ReadLine(); | |
if (userInput == password) | |
{ | |
Console.WriteLine($"Пароль введен верно!\nСекретное слово - {secretSword}"); | |
i = countMax; | |
} | |
else | |
{ | |
int currentCount = countMax - i; | |
Console.WriteLine($"Пароль введен не верно!\nОстальо попыток - {currentCount}"); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment