Skip to content

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

Description

@ShashankAdur

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions