Insolite Numbers | Function to check if a number is an Insolite numbers ; To store sum of squares of digits ; To store product of squares of digits ; extracting digit ; Driver Code ; Function Call
function isInsolite ( n ) { let N = n ; let sum = 0 ; let product = 1 ; while ( n != 0 ) { let r = n % 10 ; sum = sum + r * r ; product = product * r * r ; n = parseInt ( n / 10 ) ; } return ( N % sum == 0 ) && ( N % product == 0 ) ; } let N = 111 ; if ( isInsolite ( N ) ) document . write ( " " ) ; else document . write ( " " ) ;