Challenge 1 Completed!

0 Aakash Aggarwal · June 13, 2015
#include <stdio.h>

#include <stdlib.h>
#include <ctype.h>

int main()
{
    int i;
    char pass[10];
    int upperCase = 0, dollar = 0, number = 0;

    printf("Enter a password\n");
    scanf(" %s",&pass);

    for(i=0;i<10;i++)
    {
       if(isupper(pass)){

        upperCase = 1;

       }

       if(isdigit(pass)){

        number = 1;

       }

       if(pass == '$'){

        dollar = 1;

       }
    }

    if(upperCase == 1 && dollar == 1 && number == 1){

        printf("Password is ok\n");

       }else{

       printf("Enter again weak password\n");
       }

       return 0;
}



Post a Reply

Replies

Oldest  Newest  Rating
0 Suraj Gautam · June 14, 2015
Hey bro you don't need ampersand for string. Remove that :) 
I checked your code but the output is not desirable.
  • 1

C

107,270 followers
About

One of the most popular languages of all time.

Links
Moderators
Bucky Roberts Administrator