Advertisement
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 Login
- {
- class Program
- {
- static void Main(string[] args)
- {
- string username = Console.ReadLine();
- string password = Console.ReadLine();
- string reversedUsername = string.Empty;
- char[] usernameCharArray = username.ToArray();
- for (int i = usernameCharArray.Length - 1; i >= 0; i--)
- {
- reversedUsername += usernameCharArray[i];
- }
- while (password != reversedUsername)
- {
- Console.WriteLine($"Incorrect password. Try again.");
- password = Console.ReadLine();
- }
- Console.WriteLine($"User {username} logged in.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement