Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Login
- {
- class MainClass
- {
- public static void Main(string[] args)
- {
- string username = Console.ReadLine();
- string correctPassword = "";
- string password = "";
- for (int letter = username.Length - 1; letter >= 0; letter--)
- {
- correctPassword += username[letter];
- }
- for (int i = 0; i < 4; i++)
- {
- password = Console.ReadLine();
- if (password == correctPassword)
- {
- Console.WriteLine($"User {username} logged in.");
- return;
- }
- else if (i == 3)
- {
- break;
- }
- else
- {
- Console.WriteLine($"Incorrect password. Try again.");
- }
- }
- Console.WriteLine($"User {username} blocked!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement