Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- int main()
- {
- char seq[100];
- int length, a = 0, num = 0, space = 0, low = 0, up = 0, n, i;
- printf("Enter the password: ");
- scanf(" %[^\n]", seq);
- length = strlen(seq);
- while(1)
- {
- if(a == 2){
- printf("Please enter again: ");
- scanf(" %[^\n]", seq);
- length = strlen(seq);
- }
- else if(a == 1){
- break;
- }
- if(length >= 8)
- {
- for(i=0; i<length; i++)
- {
- if(seq[i] == ' ')
- {
- printf("Weak Password! ");
- a = 2;
- break;
- }
- if(seq[i]>= 97 && seq[i]<=122)
- {
- low++;
- }
- else if(seq[i]>=65 && seq[i]<=90)
- {
- up++;
- }
- else if(seq[i]>=48 && seq[i]<=57)
- {
- num++;
- }
- }
- if(low >=1 && up>=1 && num>=1)
- {
- printf("Strong Password!\n");
- a = 1;
- }
- else
- {
- printf("Weak Password!");
- a = 2;
- continue;
- }
- }
- else{
- printf("Weak Password! ");
- a = 2;
- continue;
- }
- }
- }
Add Comment
Please, Sign In to add comment