Greatest divisor which divides all natural number in range [ L , R ] | Function to return the greatest divisor that divides all the natural numbers in the range [ l , r ] ; Driver Code
function find_greatest_divisor ( l , r ) { if ( l == r ) return l ; return 1 ; } let l = 2 ; let r = 12 ; document . write ( find_greatest_divisor ( l , r ) ) ;