fork download
  1. /*#include<stdio.h>
  2. int main()
  3. {
  4.   int n,pass=1223;
  5.  
  6.   for(int i=1;i<=3;i++)
  7.   {
  8.   printf("Enter password: ");
  9.   scanf("%d",&n);
  10.   if(n==pass){
  11.   printf("Access Granted");
  12.   goto end;
  13.   }
  14.   else if(i<3) {
  15.   printf("Wrong Password\n");
  16.   }
  17.   }
  18.   printf("Wrong Password. You are an imposter");
  19.   end:
  20.   }
  21.   */
  22. #include<stdio.h>
  23. int main()
  24. {
  25. int n;
  26. int attempts=0;
  27. while(attempts<3)
  28. {
  29. scanf("%d",&n);
  30. printf("Enter password: %d\n",n);
  31.  
  32. if(n==1223)
  33. {
  34. printf("Access Granted\n");
  35. break;
  36. }
  37. else
  38. {
  39. printf("Wrong Password\n");}
  40. attempts++;
  41. }
  42. printf("You are an imposter");
  43.  
  44.  
  45.  
  46. return 0;
  47. }
Success #stdin #stdout 0.02s 25516KB
stdin
Standard input is empty
stdout
/*#include<stdio.h>
int main()
{
    int n,pass=1223;

    for(int i=1;i<=3;i++)
    {
        printf("Enter password: ");
        scanf("%d",&n);
        if(n==pass){
            printf("Access Granted");
            goto end;
        }
        else if(i<3) {
            printf("Wrong Password\n");
        }
        }
        printf("Wrong Password. You are an imposter");
        end:
    }
        */
       #include<stdio.h>
int main()
{
 int n;
 int attempts=0;
 while(attempts<3)
 {
    scanf("%d",&n);
    printf("Enter password: %d\n",n);
 
     if(n==1223)
 {
 printf("Access Granted\n");
 break;
 }
 else
 {
printf("Wrong Password\n");}
attempts++;
 }
printf("You are an imposter");


 
 return 0;
}