Check if a number can be represented as sum of non zero powers of 2 | C # implementation of the approach ; Function that return true if n can be represented as the sum of powers of 2 without using 2 ^ 0 ; Driver code
using System ; class GFG { static bool isSumOfPowersOfTwo ( int n ) { if ( n % 2 == 1 ) return false ; else return true ; } public static void Main ( ) { int n = 10 ; if ( isSumOfPowersOfTwo ( n ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }