SHARE
TWEET

Untitled

a guest Jan 26th, 2019 136 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace P05login
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string username = Console.ReadLine();
  10.             string passWord = "";
  11.  
  12.  
  13.             for (int i = username.Length - 1; i >= 0; i--)
  14.             {
  15.  
  16.                 passWord += username[i];
  17.  
  18.             }
  19.             string passWordEntered = Console.ReadLine();
  20.  
  21.             for (int i = 1; i <=4; i++)
  22.             {
  23.                 if (passWord != passWordEntered && i<4)
  24.                 {
  25.                     Console.WriteLine("Incorrect password. Try again.");
  26.                     passWordEntered = Console.ReadLine();
  27.                 }
  28.                 else if(passWord != passWordEntered && i == 4)
  29.                 {
  30.                     Console.WriteLine($"User {username} blocked!");
  31.                 }
  32.                 else
  33.                 {
  34.                     Console.WriteLine($"User {username} logged in.");break;
  35.                 }
  36.             }
  37.  
  38.            
  39.  
  40.  
  41.            
  42.         }
  43.     }
  44. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top