d.c~
389 Bytes
#include <stdio.h>
int main() {
int n = 0,
temp = 0,
sum = 0;
char c;
printf("Integer: ");
if (scanf("%d%c%d", &n, &c, &temp) <= 2 || n <= 0) {
printf("Invalid number!\n");
return 1;
}
else
temp = n;
do {
sum += temp % 10;
temp /= 10;
} while (temp);
printf("Digit-sum of %d = %d\n", n, sum);
return 0;
}