text: Number of ways to split a binary number such that every part is divisible by 2 | C # implementation of the approach ; Function to return the required count ; If the splitting is not possible ; To store the count of zeroes ; Counting the number of zeroes ; Return the final answer ; Driver code
code: using System ; class GFG { static int maxN = 20 ; static int maxM = 64 ; static int cntSplits ( String s ) { if ( s [ s . Length - 1 ] == '1' ) return 0 ; int c_zero = 0 ; for ( int i = 0 ; i < s . Length ; i ++ ) c_zero += ( s [ i ] == '0' ) ? 1 : 0 ; return ( int ) Math . Pow ( 2 , c_zero - 1 ) ; } public static void Main ( String [ ] args ) { String s = "10010" ; Console . WriteLine ( cntSplits ( s ) ) ; } }