#include <stdio.h>

int main() {
    int input;

    while (1) {
        printf("Enter an integer (negative number to exit): ");
        scanf("%d", &input);

        if (input < 0) {
            printf("You entered a negative number. Exiting...\n");
            break;
        }

        printf("You entered: %d\n", input);
    }

    return 0;
}

Embed on website

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