fork download
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int pass,attempt=0;
  5. while(scanf("%d",&pass) != EOF)
  6. {
  7. printf("Enter password: %d\n",pass);
  8. if(pass==1223)
  9. {
  10. printf("Access Granted\n");
  11. break;
  12. }
  13. else
  14. {if(attempt<2)
  15. {
  16. printf("Wrong password\n");
  17. attempt++;
  18. }
  19. else
  20. {
  21. printf("You are an imposter\n");
  22. }
  23. }
  24. }
  25. return 0;
  26. }
Success #stdin #stdout 0.02s 25508KB
stdin
Standard input is empty
stdout
#include<stdio.h>
int main()
{
   int pass,attempt=0;
   while(scanf("%d",&pass) != EOF)
   {
    printf("Enter password: %d\n",pass);
    if(pass==1223)
    {
        printf("Access Granted\n");
        break;
    }
    else 
    {if(attempt<2)
    {
        printf("Wrong password\n");
        attempt++;
    }
    else 
    {
    printf("You are an imposter\n");
    }
}
}
    return 0;
}