+ 1

Password validator

Can we create password validator in C, which has alphanumeric characters and atleast one special character without space???

24th Jul 2019, 3:12 PM
MANSOOR PASHA
MANSOOR PASHA - avatar
2 Antworten
+ 2
Why should that not be possible?
24th Jul 2019, 3:16 PM
HonFu
HonFu - avatar
+ 2
#include <stdio.h> main() { char s[100]; scanf("%s",&s); int i,length ,numbers=0, special_characters=0; length=strlen(s); for(i=0;i<length;i++){ if(s[i]>='0'&&s[i]<='9'){ numbers++; } else if(s[i]=='!'||s[i]=='@'||s[i]=='#'||s[i]=='
#x27;||s[i]=='%'||s[i]=='&'||s[i]=='*'){ special_characters++; } } if(length>=7 && special_characters>=1 && numbers>=2){ printf("Strong"); } else { printf("Weak"); } } You can try this one..It will be valid if at least 1 special character, length>=7 and 2 or more numbers. You can modify this as you need.. .
2nd May 2020, 6:19 AM
View My Project
View My Project - avatar