problem for 1st challenge

0 JAPJEET SINGH · August 11, 2015
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

int main()
{

    char pass[20];
    int i,flag;
    printf("Enter the password:");
    scanf(" %s",pass);
    for(i=0;i<=20;i++){
        if(isdigit(pass)||pass=='$')
           flag=1;
           else{
            flag=0;
            break;
           }
    }

            if(flag==1){
            printf("good password");
            }
            else{
            printf("bad password");
            }
    return 0;
}



Post a Reply

Replies

Oldest  Newest  Rating
0 Sha Kal · August 16, 2015
did you type digit?
0 JAPJEET SINGH · August 16, 2015
Thnx was just for the reply @Sha Kal.Actually your code outputs pw is not correct even if i typed lowercase,uppercase and$..
0 JAPJEET SINGH · August 15, 2015
Tnx Sha kal
0 c student · August 12, 2015
@Ante Saravanja

you used one = sign.  you need to use == for comparison
0 Ante Saravanja · August 12, 2015
What to do there? 
0 Sha Kal · August 12, 2015
for (i=0; i<12; i++){
      if(isalpha (password(i) )  pw=1;
      if(isupper (password(i) )  upp=1;
      if(islower (password(i) )  low=1;
      if(isdigit (password(i) )  num=1;

      if(password(i)=='$")  symbol=1;
}


if (pw==1 && upp==1 && low==1 && num==1 && symbol==1) printf("Pw is correct!");
else printf("Pw is not correct!");


//all you lines of code are in this tiny for loop.
0 Ante Saravanja · August 12, 2015
/images/forum/upload/2015-08-12/7f9a412a11c62d03ef780f8e2d758270.jpg
0 Sha Kal · August 12, 2015
1. Specify a problem so people can answer you

2. You miss a LOT in this code
  • 1

C

107,030 followers
About

One of the most popular languages of all time.

Links
Moderators
Bucky Roberts Administrator