Advertisement
AleksandarETF

Password

Mar 4th, 2015
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.86 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     int counter;
  7.     int i;
  8.     char password[10];
  9.     counter=0;
  10.     printf("Enter your password (maximum 9 characters): ");
  11.     scanf("%s", password);
  12.     printf("\n");
  13.     for (i=0;i<10;i++){
  14.       if (isalpha(password[i])) {
  15.         if (isupper(password[i])) {
  16.             counter++;
  17.             break;
  18.         }
  19.       }
  20.     }
  21.     for (i=0;i<10;i++){
  22.       if (isalpha(password[i])) {
  23.         if (islower(password[i])) {
  24.             counter++;
  25.             break;
  26.         }
  27.       }
  28.     }
  29.     for (i=0;i<10;i++){
  30.       if (isdigit(password[i])) {
  31.         counter++;
  32.         break;
  33.       }
  34.     }
  35.     if (counter==3){
  36.         printf("Your password is correct.\n");
  37.     }
  38.     else {
  39.         printf("\aYour password is not correct.\n");
  40.     }
  41.     printf("%s", password);
  42.     return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement