fork download
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. int main() {
  4. int password = 5678;
  5. int input, temp = 1;
  6. while (temp <= 3) {
  7. printf("Enter password:"); scanf("%d" , &input);
  8. if (input == password) {
  9. break;}
  10. else
  11. {if (temp == 3) {
  12. printf("Input password at %d no correct. Exiting program. \n", temp); exit(0);}
  13. else
  14. {printf("Input password at %d no correct. \n",temp);}
  15. }
  16. temp++;
  17. }
  18. }
Success #stdin #stdout 0.02s 25792KB
stdin
Standard input is empty
stdout
#include<stdio.h>
#include<stdlib.h>
int main() {
  int password = 5678;
  int input, temp = 1;
  while (temp <= 3) {
    printf("Enter password:"); scanf("%d" , &input);
    if (input == password) {
      break;}
    else
      {if (temp == 3) {
        printf("Input password at %d no correct. Exiting program. \n", temp); exit(0);}
        else
        {printf("Input password at %d no correct. \n",temp);}
    }
  temp++;
  }
}