Advertisement
Guest User

Untitled

a guest
May 16th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp85
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string userName = Console.ReadLine();
  10. string pass = string.Empty;
  11.  
  12. for (int i = userName.Length - 1; i >= 0; i--)
  13. {
  14. pass += userName[i];
  15. }
  16. int count = 1;
  17. while (true)
  18. {
  19. string input = Console.ReadLine();
  20. if (input == pass)
  21. {
  22. Console.WriteLine($"User {userName} logged in.");
  23. break;
  24. }
  25. else if (count == 4)
  26. {
  27. Console.WriteLine($"User {userName} blocked!");
  28. }
  29. else
  30. {
  31. Console.WriteLine("Incorrect password. Try again.");
  32. }
  33. count++;
  34. }
  35.  
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement