Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

sum digits of number

var value = 2568,
    sum = 0;

while (value) {
    sum += value % 10;
    value = Math.floor(value / 10);
}

console.log(sum);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sum #digits #number
ADD COMMENT
Topic
Name
6+1 =