Check if a number can be written as sum of three consecutive integers | function to check if a number can be written as sum of three consecutive integers . ; if n is multiple of 3 ; else prvar " - 1" . ; Driver program to test above function
function checksum ( n ) { if ( n % 3 == 0 ) document . write ( n / 3 - 1 + " " + n / 3 + " " + ( n / 3 + 1 ) ) ; else document . write ( " " ) ; } var n = 6 ; checksum ( n ) ;