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 _5.Login
- {
- class Program
- {
- static void Main(string[] args)
- {
- string Username = Console.ReadLine();
- string CorrectPassword = "";
- int WrongPassword = 1;
- for (int i= Username.Length-1; i>=0 ; i--)
- {
- CorrectPassword += Username[i];
- }
- string Password = Console.ReadLine();
- while(Password!= CorrectPassword && WrongPassword<=3)
- {
- WrongPassword++;
- Console.WriteLine("Incorrect password. Try again.");
- Password = Console.ReadLine();
- }
- if (WrongPassword > 3)
- {
- Console.WriteLine($"User {Username} blocked!");
- }
- else
- {
- Console.WriteLine($"User {Username} logged in.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment