Count of numbers in range [ L , R ] with LSB as 0 in their Binary representation | Java implementation of the approach ; Function to return the count of required numbers ; Count of numbers in range which are divisible by 2 ; Driver Code
import java . io . * ; class GFG { static int countNumbers ( int l , int r ) { return ( ( r / 2 ) - ( l - 1 ) / 2 ) ; } public static void main ( String [ ] args ) { int l = 10 ; int r = 20 ; System . out . println ( countNumbers ( l , r ) ) ; } }