Recursive Programs to find Minimum and Maximum elements of array | Recursive C # program to find minimum ; function to return minimum element using recursion ; if size = 0 means whole array has been traversed ; Driver code
using System ; class GFG { public static int findMinRec ( int [ ] A , int n ) { if ( n == 1 ) return A [ 0 ] ; return Math . Min ( A [ n - 1 ] , findMinRec ( A , n - 1 ) ) ; } static public void Main ( ) { int [ ] A = { 1 , 4 , 45 , 6 , - 50 , 10 , 2 } ; int n = A . Length ; Console . WriteLine ( findMinRec ( A , n ) ) ; } }