Last active
May 16, 2023 16:06
-
-
Save Strelok78/34c63f7abbe56172684585ef945ee4a8 to your computer and use it in GitHub Desktop.
The user enters the password, then user has 3 chances to enter correct password. If the password fits, it outputs a secret message, else program ends.
This file contains hidden or 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
namespace MyCode | |
{ | |
internal class Program | |
{ | |
static void Main(string[] args) | |
{ | |
string enter; | |
string password = "iJunior"; | |
int tries = 3; | |
for (int i = 0; i < tries; i++) | |
{ | |
Console.WriteLine("Enter password:"); | |
enter = Console.ReadLine(); | |
if (enter == password) | |
{ | |
Console.WriteLine("Correct password!"); | |
Console.WriteLine("LEEROY JENKIIIIINS!"); | |
break; | |
} | |
else | |
{ | |
Console.WriteLine("Worng password, try again!\n"); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment