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