SHARE
TWEET

Untitled

a guest Jan 21st, 2020 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace Login
  4. {
  5.     class MainClass
  6.     {
  7.         public static void Main(string[] args)
  8.         {
  9.             string username = Console.ReadLine();
  10.             string correctPassword = "";
  11.             string password = "";
  12.  
  13.             for (int letter = username.Length - 1; letter >= 0; letter--)
  14.             {
  15.                 correctPassword += username[letter];
  16.             }
  17.  
  18.             for (int i = 0; i < 4; i++)
  19.             {
  20.                 password = Console.ReadLine();
  21.  
  22.                 if (password == correctPassword)
  23.                 {
  24.                     Console.WriteLine($"User {username} logged in.");
  25.                     return;
  26.                 }
  27.  
  28.                 else if (i == 3)
  29.                 {
  30.                     break;
  31.                 }
  32.  
  33.                 else
  34.                 {
  35.                     Console.WriteLine($"Incorrect password. Try again.");
  36.                 }
  37.             }
  38.  
  39.             Console.WriteLine($"User {username} blocked!");
  40.         }
  41.     }
  42. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top