Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace apps
- {
- class Program
- {
- static void Main()
- {
- string password = Console.ReadLine();
- output(password);
- }
- static void output(string password)
- {
- int Digits = password.Count(char.IsDigit);
- int Letters = password.Count(char.IsLetter);
- if (password.Length < 6 || password.Length > 10){Console.WriteLine("Password must be between 6 and 10 characters");}
- if (Digits + Letters < password.Length) { Console.WriteLine("Password must consist only of letters and digits"); }
- if (Digits >= 2) { Console.WriteLine("Password is valid"); } else { Console.WriteLine("Password must have at least 2 digits"); }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment