#include <stdio.h>

int main() {
    printf("\nWelcome To Mr. Lock system: ");

    const int correctPassword = 2005;
    int password;
    int maxAttempts = 3;

    for (int attempt = 1; attempt <= maxAttempts; ++attempt) {
        printf("\nPlease enter your password: ");
        scanf("%d", &password);

        if (password == correctPassword) {
            printf("\nThe password is correct.\nHello, my close friend!\n");
            break;  // Exit the loop if the password is correct
        } else {
            printf("\nThe password is incorrect.\n");
            int remainingAttempts = maxAttempts - attempt;
            if (remainingAttempts > 0) {
                printf("You have %d more %s.\n", remainingAttempts, remainingAttempts > 1 ? "attempts" : "attempt");
            } else {
                printf("You have no more attempts. Locking system.\n");
            }
        }
    }

    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: