text: Highest power of 2 less than or equal to given number | C # program to find highest power of 2 smaller than or equal to n . ; Driver code
code: using System ; class GFG { static int highestPowerof2 ( int n ) { int p = ( int ) ( Math . Log ( n ) / Math . Log ( 2 ) ) ; return ( int ) Math . Pow ( 2 , p ) ; } static public void Main ( ) { int n = 10 ; Console . WriteLine ( highestPowerof2 ( n ) ) ; } }