Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace demo
- {
- class Program
- {
- static void Main()
- {
- string username = Console.ReadLine();
- string password = string.Empty;
- int count = 0;
- bool isLoged = true;
- for (int i = username.Length - 1; i >= 0; i--)
- {
- password += username[i];
- }
- string command = Console.ReadLine();
- while (password != command)
- {
- count += 1;
- if (count > 3)
- {
- Console.WriteLine($"User {username} blocked!");
- isLoged = false;
- break;
- }
- Console.WriteLine("Incorrect password. Try again.");
- command = Console.ReadLine();
- }
- if (isLoged)
- {
- Console.WriteLine($"User {username} logged in.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment