/* program entry */
int main (void)
{
int n,/* n stores the number you entered */
s; /* s stores the sum you want to add */
/* First read an integer from the command line and store it in n */
scanf ("%d",&; n);
/* If the read integer is negative, the negative is positive, and it is changed into the corresponding opposite number through the negative sign */
/* If the N is still negative without this step, then the remainder is negative when the remainder is calculated */
/* If the negative number is added to the sum S, the result is naturally incorrect */
If (n < ) n = -n;
/* *
* When n is not equal to , the loop continues
* Because the value of n will be constantly changed in the loop body, it will eventually become */
*/
while (n! = )
{
/* By modulo operation, the remainder of n divided by 1 is obtained, that is, the present single digit of n */
/* If n = 327, then the quotient of n divided by 1 is 32, and the remainder is a digit of 7 */
s = s+n% 1;
/* In C, when the int integer variable is divided by the int integer variable, the decimal part of the result will be directly removed, so the quotient is an integer */
/* 327 divided by 1, and the accurate result is 32.7. After the decimal part is removed, the result is 32 */
/*, and then this quotient is assigned to N as the new value of N, which makes N remove the original value. It becomes a two-digit number */
/* 327/1, and the result is a two-digit number 32 */
n = n/1;
/* Next cycle, take out the single digit of N and add it to the sum S */
/* When N changes from two digits to one digit */
/* Next cycle, because n% 1 is itself */
/* The result of N/1 is , and is the new value of N. = when the judgment is not established, the loop ends */
}
printf ("%d \ n", s);
return ;
}
/* If you don't understand anything, please ask. */