Stan0033

Untitled

Jun 16th, 2021
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. namespace apps
  4. {
  5. class Program
  6. {
  7. static void Main()
  8. {
  9. string password = Console.ReadLine();
  10. output(password);
  11. }
  12.  
  13. static void output(string password)
  14. {
  15. int Digits = password.Count(char.IsDigit);
  16. int Letters = password.Count(char.IsLetter);
  17. if (password.Length < 6 || password.Length > 10){Console.WriteLine("Password must be between 6 and 10 characters");}
  18. if (Digits + Letters < password.Length) { Console.WriteLine("Password must consist only of letters and digits"); }
  19. if (Digits >= 2) { Console.WriteLine("Password is valid"); } else { Console.WriteLine("Password must have at least 2 digits"); }
  20.  
  21. }
  22.  
  23. }
  24. }
  25.  
  26.  
Advertisement
Add Comment
Please, Sign In to add comment