Count of all even numbers in the range [ L , R ] whose sum of digits is divisible by 3 | Java implementation of the approach ; Function to return the count of required numbers ; Count of numbers in range which are divisible by 6 ; Driver code
class GFG { static int countNumbers ( int l , int r ) { return ( ( r / 6 ) - ( l - 1 ) / 6 ) ; } public static void main ( String [ ] args ) { int l = 1000 , r = 6000 ; System . out . println ( countNumbers ( l , r ) ) ; } }