Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I am unable to code for the Challenge 1 in C language #137

Open
ShashankAdur opened this issue Apr 24, 2019 · 5 comments
Open

I am unable to code for the Challenge 1 in C language #137

ShashankAdur opened this issue Apr 24, 2019 · 5 comments

Comments

@ShashankAdur
Copy link

First of all I would like to thank you for providing a great tutorial for C language. U helped me get a confidence that even I can code.
The issue is that I tried the code for the challenge 1 in C language.
The question was : To create a code to check whether the password has a alphabet, a number and a $ sign.

The code I entered is :
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>

int main()
{
char password[50];
printf("please set a password with '$' sign: \n");
scanf(" %s", password);

( password == (isalpha(password)) && (isdigit(password)) && ('$') ) ? printf("Ur password is OK and u r good to go\n") : printf("Try a new password as per the terms and condition\n");

return 0;

}

I even tried with a normal If and Else loop but I am unable to get the answer. The above code runs without any error but directly jumps into the Else part.
I tried to refer ur website but the website isn't opening. Kindly help me to know the mistake done in this code.
Output obtained for the above mentioned code:

WhatsApp Image 2019-04-23 at 18 37 54

Using If and Else method :

WhatsApp Image 2019-04-23 at 19 19 16

@paulosuji
Copy link

paulosuji commented Apr 30, 2019 via email

@RubySayyedPanwaar
Copy link

Have you got the answer??

@ShashankAdur
Copy link
Author

ShashankAdur commented May 22, 2019 via email

@coder-nechi
Copy link

Look at that the '&' operator is missing before variable 'password' inside scanf

@ShashankAdur
Copy link
Author

ShashankAdur commented Jun 29, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants