This is a basic math algorithm to find the sum of digits of a number. we will take the number and then we will find the last digit of the number by using the modulo(%) operator. Once the last digit has been taken we will update the number by discarding the last digit. The last digit can be discarded by dividing the number with 10 and then storing the number in a integer data type variable. This will automatically cast the float or double variable into int.
Ещё видео!