Count of numbers whose 0 th and Nth bits are set | C # implementation of the approach ; Function to return the count of n - bit numbers whose 0 th and nth bits are set ; Driver code
using System ; class GFG { static int countNum ( int n ) { if ( n == 1 ) return 1 ; int count = ( int ) Math . Pow ( 2 , n - 2 ) ; return count ; } static public void Main ( ) { int n = 3 ; Console . WriteLine ( countNum ( n ) ) ; } }