#include <stdio.h>

int main() {
    int num;
    int sum = 0;
    int count = 0;

    // Input integers until a non-integer input is provided
    printf("Enter integers (enter a non-integer to stop):\n");

    while (scanf("%d", &num) == 1) {
        int currentNum = num;

        // Calculate the sum of the digits of the entered integer
        while (currentNum != 0) {
            sum += currentNum % 10;
            currentNum /= 10;
        }

        // Increment the count for each entered integer
        count++;
    }

    // Display the results
    printf("Number of integers entered: %d\n", count);
    printf("Sum of the digits: %d\n", sum);

    return 0;
}

Embed on website

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