Challenge #1

+4 yagel asd · August 11, 2014
    #include <stdio.h>
    #include <stdlib.h>
    #include <ctype.h>
    int main()
    {
    int i=0;
    char chr;
    int dollar,upperC,number=0;
       char password[100];
       scanf("%s",password);
    for( i=0;i<=99;i++){
            chr=password;

            if(chr=='$'){
                dollar=1;
            }
            if(isdigit(chr)){
                number=1;
            }
                    if(isupper(chr)){
                upperC=1;
            }
    }
    if(dollar==1&&number==1&&upperC==1){
        printf("your password had accepted");
    }else{
        printf("your password had not accepted");
    }
       return 0;
    }

Post a Reply

Replies

Oldest  Newest  Rating
0 Jurgen B · August 18, 2014
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <math.h>

int main()
{
char password[10];
printf("Enter your password:\n");
scanf(" %s ", password);
    if(isdigit(password)){
        if(password=='$'){
            if(isupper(password)){
            printf("Your password is correct!");
            }else{printf("Your password fails!");}
        }else{printf("Your password fails!");}
    }else{printf("Your password fails!");}
 return 0;
}

I made this programm, it runs, but it doesn't continue after scanf or it fails. Can somebody help me? What am I doing wrong?
  • 1

C

107,337 followers
About

One of the most popular languages of all time.

Links
Moderators
Bucky Roberts Administrator