It is very easy just separate the digits from the original number and then add it with one another you can do this by a simple logic:

Let n be your input number, I is a working variable, sum is the total which you want and all are positive integers.

while(n!=0)

I=n%10;

n=n/10;

sum=sum+I;

For complete code click here.

Enjoy blurting :)

Let n be your input number, I is a working variable, sum is the total which you want and all are positive integers.

while(n!=0)

I=n%10;

n=n/10;

sum=sum+I;

For complete code click here.

Enjoy blurting :)