Password Strength Checker
C
Hard
4 views
Problem Description
Have the user input a password (it should not be visible on the screen). Then check: minimum 8 characters, at least 1 digit, and 1 uppercase letter. Report the result and provide suggestions if applicable.
Official Solution
#include <stdio.h>
#include <conio.h>
#include <ctype.h>
#include <string.h>
int main() {
char password[50];
int i = 0;
int hasUpper = 0, hasDigit = 0;
printf("Enter password: ");
// Read password without echo
while (1) {
char ch = getch();
if (ch == 'r') { // Enter key
password[i] = '