Write a C++ program to find sum of digits of a number
Suppose you have a number n and you want to find the sum of its digits. For example, if n = 123, then the sum of its digits is 1 + 2 + 3 = 6.
Input : 123
Output : 6
How to contribute
- Save the solution in `FindSumOfDigitsOfANumber.cpp` file
- Add `FindSumOfDigitsOfANumber.cpp` file in `program/find-sum-of-digits-of-a-number` folder
Description
Write a C++ program to find sum of digits of a number
Suppose you have a number
n
and you want to find the sum of its digits. For example, ifn = 123
, then the sum of its digits is1 + 2 + 3 = 6
.How to contribute
- Save the solution in `FindSumOfDigitsOfANumber.cpp` file - Add `FindSumOfDigitsOfANumber.cpp` file in `program/find-sum-of-digits-of-a-number` folder