Challenge 1 help me

+1 Suraj Gautam · June 3, 2015
#include <stdio.h>
#include <conio.h>
void main ()
{
char password[30];
int i=0, upper=0, digit=0, sign=0;
int number;
printf("Enter the password\n\n");
scanf("%s",password);
while(i<30)
{
if(password=='$')
{
sign=1;
}
if (password>='A'&& password <='Z')
{
upper=1;
}
if (password==number)
{
digit=1;
}
i++;
}
(upper==1 && digit==1  && sign==1)? printf("Your password is good to go") : printf("Your password sucks");
}

Post a Reply

Replies

Oldest  Newest  Rating
+1 Suraj Gautam · June 3, 2015
#include <stdio.h>
#include <conio.h>
void main ()
{
char password[30];
int i=0, upper=0, digit=0, sign=0;
int number;
printf("Enter the password\n\n");
scanf("%s",password);
while(i<30)
{
if(password=='$')
{
sign=1;
}
if (password>='A'&& password <='Z')
{
upper=1;
}
if (password==number)
{
digit=1;
}
i++;
}
(upper==1 && digit==1  && sign==1)? printf("Your password is good to go") : printf("Your password sucks");
}
0 rasen itachi · June 3, 2015
You need to use isupper and isdigit commands by nesting if statements, thats how i got it to check digits and caps...about the dollas sign i have no idea.
0 Suraj Gautam · June 3, 2015
Thanks for the tips rasen bro but in this way also this problem can be solved. I don't know what is wrong in this code....
0 c student · June 3, 2015
fix your while loop
0 Suraj Gautam · June 3, 2015
hehe c student 
that is while (i<  30)
0 c student · June 3, 2015
did you check your numbers correctly?
  • 1

C

107,324 followers
About

One of the most popular languages of all time.

Links
Moderators
Bucky Roberts Administrator