Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Login
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string username = Console.ReadLine();
  10.  
  11. string password = "";
  12.  
  13. for (int i = username.Length - 1; i >= 0; i--)
  14. {
  15. password += username[i];
  16.  
  17. }
  18.  
  19.  
  20. for (int i = 0; i < 3; i++)
  21. {
  22. string inputPass = Console.ReadLine();
  23.  
  24. if (password == inputPass)
  25. {
  26. Console.WriteLine($"User {username} logged in.");
  27. return;
  28. }
  29. else
  30. {
  31. Console.WriteLine("Incorrect password. Try again.");
  32. }
  33.  
  34. }
  35.  
  36. string lastTryPassword = Console.ReadLine();
  37.  
  38. if(password == lastTryPassword)
  39. {
  40. Console.WriteLine($"User {username} logged in.");
  41. }
  42. else
  43. {
  44. Console.WriteLine($"User {username} blocked!");
  45. }
  46.  
  47. }
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement