Password Validator code coach test case #8 not passing. pls help! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Password Validator code coach test case #8 not passing. pls help!

This is my code. Its not passing test case #8. All other 12 test cases it passed without any issue. #include <stdio.h> #include <string.h> int main() { char str[20], num[15] = {'1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '\0'}, schar[8] = {'!', '@', '#', '

#x27;, '%', '&', '*', '\0'}; int t, ct1, ct2; scanf("%s", str); t = strlen(str); for(int i=0; i<t; i++) { for(int j=0; j<10; j++) { if (str[i] == num[j]) ct1++; else if (str[i] == schar[j]) ct2++; } } if (t>6 && ct2>1 && ct1>1) printf("Strong"); else printf("Weak"); return 0; }

3rd Mar 2021, 11:54 AM
Bittu Joshi
Bittu Joshi - avatar
2 Answers
+ 1
I don’t know the “strong” password criteria. But I suspect your error is with the line: if(t>6 && .... —- double-check that logic.
17th Mar 2021, 10:30 PM
Jerry Hobby
Jerry Hobby - avatar
+ 1
Ok. I will check and tell u if it works. Later. Today is my computer programming exam and I need to learn file management in c. Time let: 1 hour. 😭😭
18th Mar 2021, 6:42 AM
Bittu Joshi
Bittu Joshi - avatar