Find sum of digits in a given number
Notes:
 Compute the Sum of Digits in a given Integer: 
                                                Program to find sum of digits of a number using while loop:
                                                
                                                var num=12; 
                                                var lastDigit=0; 
                                                var sumOfAllDigits=0; 
                                                while(num!=0)
                                                {
                                                lastDigit= num % 10;
                                                sumOfAllDigits = sumOfAllDigits + lastDigit;
                                                num = parseInt(num/10);
                                                }
                                                document.write("Sum of all digits : ", sumOfAllDigits);
                                                
                                        
Interview Questions: