Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp76
- {
- class Program
- {
- static void Main(string[] args)
- {
- char[] user = Console.ReadLine().ToCharArray();
- char[] password = user.Reverse().ToArray();
- int count = 0;
- while (true)
- {
- char[] input = Console.ReadLine().ToCharArray();
- for (int i = 0; i <= user.Length - 1; i++)
- {
- if (input[i] == password[i])
- {
- Console.WriteLine($"User {string.Join("",user)} logged in.");
- break;
- }
- else
- {
- count++;
- if (count > 3)
- {
- Console.WriteLine("User sunny blocked!");
- break;
- }
- else
- {
- Console.WriteLine("Incorrect password. Try again.");
- break;
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement