Advertisement
Salman_CUET_18

password_problem

Mar 19th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.06 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. int main()
  4. {
  5.     int i, len;
  6.     int  digit_exists = 0, small_letter_exists = 0, capital_letter_exists = 0, symbol_exists = 0;
  7.     char password[10000];
  8.  
  9.     gets(password);
  10.     len = strlen(password);
  11.  
  12.    if(len >= 8)
  13.     {
  14.  
  15.         for(i = 0; i < len; i++)
  16.         {
  17.             if(password[i] >= 'A' && password[i] <= 'Z')
  18.                 capital_letter_exists++;
  19.  
  20.             else if(password[i] >= 'a' && password[i] <= 'z')
  21.                 small_letter_exists++;
  22.  
  23.             else if(password[i] >= '0' && password[i] <= '9')
  24.                     digit_exists++;
  25.  
  26.             else
  27.                 symbol_exists++;
  28.             //capital and small letter and digits na hole seta special character,oitar jonnoi symbol exixts use korsi
  29.  
  30.         }
  31.  
  32.     }
  33.  
  34.         if(small_letter_exists != 0 && capital_letter_exists != 0 && symbol_exists != 0)
  35.         {
  36.             printf("Valid Password!\n");
  37.  
  38.         }
  39.         else
  40.         {
  41.             printf("Invalid Password!\n");
  42.         }
  43.         return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement