Greatest divisor which divides all natural number in range [ L , R ] | C # implementation of the approach ; Function to return the greatest divisor that divides all the natural numbers in the range [ l , r ] ; Driver Code
using System ; class GFG { static int find_greatest_divisor ( int l , int r ) { if ( l == r ) { return l ; } return 1 ; } public static void Main ( ) { int l = 2 , r = 12 ; Console . WriteLine ( find_greatest_divisor ( l , r ) ) ; } }