#include stdio.h
#include string.h
#include ctype.h
int main() {
char password[100];
int length, has_uppercase, has_lowercase, has_digit, i;
printf("Enter a password: ");
scanf("%s", password);
length = strlen(password);
if (length 8) {
printf("Weak password: too short\n");
return 1;
}
has_uppercase = 0;
for (i = 0; i length; i++) {
if (isupper(password[i])) {
has_uppercase = 1;
break;
}
}
has_lowercase = 0;
for (i = 0; i length; i++) {
if (islower(password[i])) {
has_lowercase = 1;
break;
}
}
has_digit = 0;
for (i = 0; i length; i++) {
if (isdigit(password[i])) {
has_digit = 1;
break;
}
}
if (has_uppercase && has_lowercase && has_digit) {
printf("Strong password\n");
return 0;
} else {
printf("Weak password: missing ");
if (!has_uppercase) {
printf("uppercase letters ");
}
if (!has_lowercase) {
printf("lowercase letters ");
}
if (!has_digit) {
printf("digits");
}
printf("\n");
return 1;
}
}
For What inputs the following program would print "strong password"