Check if a large number is divisibility by 15 | to find sum ; function to check if a large number is divisible by 15 ; length of string ; check divisibility by 5 ; Sum of digits ; if divisible by 3 ; Driver Code
function accumulate ( s ) { let acc = 0 ; for ( let i = 0 ; i < s . length ; i ++ ) { acc += s [ i ] - ' ' ; } return acc ; } function isDivisible ( s ) { let n = s . length ; if ( s [ n - 1 ] != ' ' && s [ n - 1 ] != ' ' ) return false ; let sum = accumulate ( s ) ; return ( sum % 3 == 0 ) ; } let s = " " ; isDivisible ( s ) ? document . write ( " " ) : document . write ( " " ) ; s = " " ; isDivisible ( s ) ? document . write ( " " ) : document . write ( " " ) ;