// Sum of Digits of a Number in C using Function
// This function will make sum of digits of number itself
void DigitSum(int x) {
int sum = 0, m;
printf ("The sum of %d digits is = ", x);
while (x > 0) {
m = x%10;
sum = sum+m;
x = x/10;
}
printf ("%d\n", sum);
}
// It's the driver function
int main() {
int x;
printf ("Enter the integer number::\n");
scanf ("%d", &x);
DigitSum(x);
return 0;
}