Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Login
- {
- class Program
- {
- static void Main(string[] args)
- {
- string username = Console.ReadLine();
- char[] password = username.ToCharArray();
- Array.Reverse(password);
- string pass = new string(password);
- int counter = 0;
- string inputPass = Console.ReadLine();
- while (inputPass != pass)
- {
- Console.WriteLine("Incorrect password. Try again.");
- counter++;
- inputPass = Console.ReadLine();
- if (counter == 3)
- {
- Console.WriteLine($"User {username} blocked!");
- return;
- }
- }
- if (inputPass == pass)
- {
- Console.WriteLine($"User {username} logged in.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement