- 1

Password Validation

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Sololearn { class Program { static void Main(string[] args) { string a=Console.ReadLine(); int c=0;//thats the counter for symbols char [] b ={'!', '@', '#', '

#x27;, '%', '&', '*'}; for(int i=0;i<a.Length;i++) { for (int j=0;j<b.Length;j++) { if (a[i]==b[j]) { c++; } } } if (c>=2 && a.Length>=7) { Console.WriteLine("Strong"); } else { Console.WriteLine("Weak"); } } } } Why my code don't work ?

18th Mar 2022, 7:08 AM
Shai Shab
Shai Shab - avatar
2 ответов
+ 2
Your code is fully ok and should work. Whenever someone enters at least 7 characters having at least 2 special characters (!, @,#,$,%,&,*) within, the program output is "Strong". Otherwise output will be "Weak". No problem's there. can you tell me where did you find problem? Or what is your output?
18th Mar 2022, 11:20 AM
Satya Sundar De
Satya Sundar De - avatar
+ 1
There must be at least two more digits.
18th Mar 2022, 7:29 AM
Solo
Solo - avatar