Advertisement
Guest User

Untitled

a guest
Sep 27th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.98 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace TriangleNums
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string username = Console.ReadLine();
  14.             string pass = new string(username.Reverse().ToArray());
  15.             string input;
  16.             int counter = 0;
  17.             while (true)
  18.             {
  19.                 input = Console.ReadLine();
  20.                 if (input!=pass)
  21.                 {
  22.                     if (++counter>=4)
  23.                     {
  24.                         Console.WriteLine($"User {username} blocked");
  25.                         break;
  26.                     }
  27.                     Console.WriteLine("Incorrect password. Try again.");
  28.                 }
  29.                 else
  30.                 {
  31.                     Console.WriteLine($"User {username} logged in.");
  32.                     break;
  33.                 }
  34.             }
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement