Check if a number can be represented as sum of non zero powers of 2 | Function that return true if n can be represented as the sum of powers of 2 without using 2 ^ 0 ; Driver code
function isSumOfPowersOfTwo ( n ) { if ( n % 2 == 1 ) return false ; else return true ; } var n = 10 ; if ( isSumOfPowersOfTwo ( n ) ) document . write ( " " ) ; else document . write ( " " ) ;