To get sum of each digit by C++ program, use the following algorithm:
o Step 1: Get number by user
o Step 2: Get the modulus/remainder of the number
o Step 3: sum the remainder of the number
o Step 4: Divide the number by 10
o Step 5: Repeat the step 2 while number is greater than 0.
#sumofdigits
#cplusplustutorial