Skip to content

Commit

Permalink
Create Password.c
Browse files Browse the repository at this point in the history
  • Loading branch information
o10a19 authored and x0lg0n committed Nov 1, 2024
1 parent 347f6de commit 0752474
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions C/Password.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <stdlib.h>
#include <stdio.h>

int main() {
int pin, attempt = 3;

do {
printf("Enter your pin: ");
scanf("%d", &pin);
attempt--;

if (pin != 4008) {
printf("Incorrect PIN\n");
}

if (attempt == 0 && pin != 4008) {
printf("Incorrect PIN and no further attempts left\n");
exit(EXIT_FAILURE);
}
} while (pin != 4008);

printf("Welcome User!\n");
return 0;
}

0 comments on commit 0752474

Please sign in to comment.