Reduce the array to a single element with the given operation | C # implementation of the approach ; Function to return the final element ; Driver code
using System ; public class GFG { public static long getFinalElement ( long n ) { long finalNum ; for ( finalNum = 2 ; finalNum * 2 <= n ; finalNum *= 2 ) ; return finalNum ; } static public void Main ( ) { int N = 12 ; Console . WriteLine ( getFinalElement ( N ) ) ; } }