#include <stdio.h>

int main(void) 
{

	int number; /* the inputted number to process */
	int right_digit; /* right most digit of a number */
	int sum_of_digits; /* the sum of the digits */
	
	/* initialize sum of digits to zero */
	sum_of_digits = 0;
	
	/* prompt for number to process */
	printf("Enter your number: ");
	scanf("%d", &number);
	printf("\n");
	
	/* loop to strip out each of the digits */
	while (number != 0)
	{
		right_digit = number % 10; /* get the right most digit */
		printf("right digit = %d", right_digit);
		
		/* add right most digit to our running total */
		sum_of_digits += right_digit;
		number = number / 10; /* or number /* 10; */
		printf(", number = %d\n", number);
	}
	
	/* output the sum of the digits */
	printf("\nSum_of_digits = %d\n", sum_of_digits);
	
	return (0);
}