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