Count total bits in a number | Function to get no of bits in binary representation of positive integer ; Driver Code
using System ; class GFG { static int countBits ( int n ) { int count = 0 ; while ( n != 0 ) { count ++ ; n >>= 1 ; } return count ; } static public void Main ( ) { int i = 65 ; Console . Write ( countBits ( i ) ) ; } }