#include <stdio.h>

char password1[] = "skgLyfg125";
char password2[] = "skglyfg125";

int maiusc(char c) {
    if(c >= 'A' && c <= 'Z') {
        return 1; // c è una lettera maiuscola       
    }
    return 0;
}

int esamina_password(char p[]) {
    int i;
    for( i=0; p[i]!='\0';i++) {
        // esamino il carattere i, ovvero p[i]
        if( maiusc(p[i]) ) {
            return 0;
        }
    }
    return 1;
}

void check(char s[]) {
    if( esamina_password(s) ) {
        printf("Password %s ok!\n",s);
    } else {
        printf("Password %s non deve contenere maiuscole!\n",s);    
    }
}

int main() {
    check(password1);
    check(password2);
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: