C Program to Sum the Digits of any number:
Here we will learn that how to add the all digits of any number which is input by user.
In which we add the all digits and show tha result.
For Example: if user input the 185 number, then the sum of the all digits is 1+8+5 = 14


ALGORITHM:-

step 1 : Start
step 2 : Input any number from user
step 3 : Find the % mod 10 and store in another variable
step 4 : Divide the number by 10 untill > = 1
step 5 : Stop

PROGRAM CODE:-

#include<stdio.h>
#include<conio.h>

void main()
{
    int num,sum=0,r;
    printf("Enter any number: ");
    scanf("%d",&num);
    while(num)
    {
        r=num%10;
        sum=sum+r;
        num=num/10;
    }
    printf("Sum of digits of number:  %d",sum);
    getch();
}

OUTPUT:-

Enter any number: 152

Sum of digits of number: 8

C Program to add the all digits of any numbers
how to add the all digits of any number
Sum of digits