Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace strong_number
- {
- class Program
- {
- static void Main()
- {
- string password = Console.ReadLine();
- int NumsCount = 0;
- int NonLetters = 0;
- if (password.Length >= 6 & password.Length <= 10)
- {
- }
- else
- {
- Console.WriteLine("Password must be between 6 and 10 characters");
- }
- char[] all = password.ToCharArray();
- for (int i = 0; i < all.Length; i++)
- {
- if (char.IsLetter(all[i])) { } else { NonLetters++; }
- if (char.IsDigit(all[i])) { NumsCount++; }
- }
- if (NonLetters > 1 & NumsCount == 0)
- {
- Console.WriteLine("Password must consist only of letters and digits");
- }
- if (NumsCount >= 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
Advertisement