0
I canât solve Password validation on C
I canât understand whatâs happened, last case is not valid, this case is 7, other cases are pass. So now Iâll put my code #include <stdio.h> #include <string.h> int weak(void); int main(void) { int num = 0; int first = 0, second = 0; char number[] = "0"; char symbol[7] = {'!','@','#','
#x27;,'%','&','*'}; char input[50]; int size; scanf("%s", input); size = strlen(input); if(size < 7) { weak(); return 0; } else for(int j = 0; j < size; j++) { for(int k = 0; k < 10; k++) { if(input[j] == number[k]) { first++; } } } for(int t = 0; t < size; t++) { for(int h = 0; h < 7; h++) { if(input[t] == symbol[h]) { second++; } } } if(first < 2 && second < 2) { weak(); return 0; } else printf("Strong"); return 0; } int weak(void) { printf("Weak"); return 0; }1 Answer
0
i donât know the parameters of the tests. but at a glance, if first < 2 && second < 2 test .. maybe use || ?