Can be help me? I can't find the error. Please.

Rafa_Morato asked 1 year ago

int r;


    while(r !=2002){
        printf("Senha Invalida\n");

        if (r == 2002){
            printf("Acesso Permitido\n");

Remember not post solutions. Your post may be reviewed by our moderators.

  • Kirsten Ernestine replied 8 months ago

    With that kind of "while" you are only readind 1 input, so is basically not a real loop. You need to read many inputs until one of them is the correct password (senha). So you do it like this: while( scanf("%d", &r)) { code code code

  • Wellerson Salvatore replied 1 year ago

    change your while:


    and after "printf" on line 9 put "break".