Determine whether the given integer N is a Peculiar Number or not | Function to find sum of digits of a number ; Function to check if the number is peculiar ; Store a duplicate of n ; Driver code
function sumDig ( n ) { var s = 0 ; while ( n != 0 ) { s = s + ( n % 10 ) ; n = parseInt ( n / 10 ) ; } return s ; } function Pec ( n ) { var dup = n ; var dig = sumDig ( n ) ; if ( dig * 3 == dup ) return true ; else return false ; } var n = 36 ; if ( Pec ( n ) == true ) document . write ( " " ) ; else document . write ( " " ) ;