text: Smallest power of 4 greater than or equal to N | C # implementation of above approach ; Function to return the smallest power of 4 greater than or equal to n ; If n is itself is a power of 4 then return n ; Driver code
code: using System ; class GFG { static int nextPowerOfFour ( int n ) { int x = ( int ) Math . Floor ( Math . Sqrt ( Math . Sqrt ( n ) ) ) ; if ( Math . Pow ( x , 4 ) == n ) return n ; else { x = x + 1 ; return ( int ) Math . Pow ( x , 4 ) ; } } public static void Main ( ) { int n = 122 ; Console . WriteLine ( nextPowerOfFour ( n ) ) ; } }