Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Main()
- {
- string username = Console.ReadLine();
- string password = "";
- string userInput = "";
- for(int i = username.Length-1;i >= 0;i--)
- {
- password += username[i];
- }
- int counter = 0;
- while((userInput = Console.ReadLine()) != password)
- {
- if(userInput != password)
- {
- if(counter == 3)
- {
- Console.WriteLine($"User {username} blocked!");
- return;
- }
- Console.WriteLine("Login not successful! Incorrect password!Try again!");
- counter++;
- }
- }
- if(userInput == password)
- {
- Console.WriteLine($"User {username} logged in.");
- }
- }
Add Comment
Please, Sign In to add comment