//C program to accept an integer & find the sum of its digits
#include <stdio.h>
int main() {
int num, digit;
int sum = 0;
int temp;
printf("Enter Number : "); //123
scanf("%d", &num);
temp = num;
while (num > 0) {
digit = num % 10;
sum = sum + digit;
num /= 10;
}
printf("\n");
printf("Given Number is: ", num);
printf("\nSum of digit: %d = %d", temp, sum);
printf("\n");
return 0;
}