C # implementation of the approach
using System ; class GFG { static int MAXN = 1000000 ; static int max_element ( int [ ] A , int n ) { int max = A [ 0 ] ; for ( int i = 0 ; i < n ; i ++ ) if ( A [ i ] > max ) max = A [ i ] ; return max ; }