Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Linq;
- using System.Threading;
- namespace ConsoleApp1
- {
- class Exam
- {
- static void Main(string[] args)
- {
- char[] username = Console.ReadLine().ToCharArray();
- char[] reverse = username.Reverse().ToArray();
- int count = 0;
- while (count < 3)
- {
- count++;
- char[] tryPass = Console.ReadLine().ToCharArray();
- if (string.Join("", tryPass) == string.Join("", reverse))
- {
- Console.WriteLine($"User {string.Join("", username)} logged in.");
- return;
- }
- else
- {
- Console.WriteLine("Incorrect password. Try again.");
- }
- }
- Console.WriteLine($"User {string.Join("", username)} blocked!");
- }
- }
- }
Add Comment
Please, Sign In to add comment