Challenge #1

+3 Debora Karalić · January 19, 2015
Hi, this is how I did this challenge.

#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
int main()
    int upperCase=0, number=0, br=0, lowerCase=0;
    char password[50];

    printf("Enter your password <longer than 8, uppercase, lowercase and a number>\n");

     printf("Type your password");  
scanf("%s", password);
    while (strlen(password)<=8);

    for (br=0; br<=strlen(password); br++)
        if (isupper(password))
    for (br=0; br<=strlen(password); br++)
        if (isdigit(password))
    for (br=0; br<=strlen(password); br++)

    if (number && lowerCase && upperCase)
        printf("\nPassword contains %d uppercase, %d numbers, %d lowercase and its ok.", upperCase, number, lowerCase);
    else printf("Think before you write.");
    if (strlen(password)-upperCase-number-lowerCase!=0)
        printf("\nYou have %d other char in your password.", strlen(password)-upperCase-number-lowerCase);
    return 0;

Post a Reply


Oldest  Newest  Rating
0 Emir ARITURK · January 28, 2015
Thanks a lot c student, you made think deeper about it than I've found the solution in a better way, thnx!! ;)
0 student abdo · January 28, 2015
plz help me i don't know what i can do in these program 
#include <iostream>
#include <stdio.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
int i;
char *t[4];
char m;
for (i=0;i<=3;i++){
printf("donnez un jour%d?\n",i+1);
for (i=0;i<=3;i++){printf("jour %d:%s\n",i+1,t);

return 0;
0 Emir ARITURK · January 28, 2015
Of course I know how to read errors,but the problem is, the compiler stops working when I execute it for this code.
0 Emir ARITURK · January 28, 2015


#define LENGTH 20

  void passwordCheck (char password[LENGTH]){
       int i ; //loop counter
        int upperCase = 0 ; // number of Upper case(s)
          int lowerCase = 0;// number of Lower case(s)
          int digit = 0 ; //number of digit(s)
             int dollar = 0 ; //number of dollar sign(s)
         for ( i = 0; i <= strlen(password) ; i++){
            if( isupper( password ) )
             upperCase++ ;
               if( islower( password ) )
                 lowerCase++ ;
                    if( isdigit( password ) )
                   digit++ ;
                    if( password == '$' )
                        dollar++ ;
          if (upperCase >= 1 && lowerCase >= 1 && digit >= 1 && dollar >=1)
          printf("Password is safe!!\n\n");
          printf("Password is not safe enough..");      
int main(){
   char passworddd[LENGTH];
        printf("\n\nPlease enter the password that you want to create (at least 5 characters) : ");
         scanf("%s\n\n", passworddd[LENGTH]);
       passwordCheck( passworddd[LENGTH] );
    return 0;

Hey friends, hope you all are doing well! I was going through that challenge thing and I've ridicilously run into an error! I really can't see what's wrong with the code above. Long story short, could anyone just help me through that? Thnx!
0 Debora Karalić · January 25, 2015
Thanx for commenting on my code,
I didn't wanted to make never-ending loop, it's just preventing user from entering password shorter than 8 characters. And about the if(numer+lowerCase+upperCase>2), it was just a mistake with uploading the wrong code. I had problems with running my code when using one for loop, so instead I used 3 (guess something is wrong with my Visual studio).
Thank you for trying to help me, cheers to you all :)
0 Aleksander Olewinski · January 20, 2015
I understand that in your opinion code is good and complete when there are never ending loops? You think Deborah wanted to make it this way. Soon I will post my next version of challenge 1 with fgets and pointers :).

Cheers mate.
0 c student · January 19, 2015
i'm guessing that's the point.
0 Aleksander Olewinski · January 19, 2015
There is a never ending loop. If someone type less than 8 characters loop will never end. 

scanf("%s", password);
while (strlen(password)<=8);
  • 1



One of the most popular languages of all time.

Bucky Roberts Administrator