Check if there is any pair in a given range with GCD is divisible by k |  ; function to count such possible numbers ; if i is divisible by k ; if count of such numbers is greater than one ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; bool Check_is_possible ( int l , int r , int k ) { int count = 0 ; for ( int i = l ; i <= r ; i ++ ) { if ( i % k == 0 ) count ++ ; } return ( count > 1 ) ; } int main ( ) { int l = 4 , r = 12 ; int k = 5 ; if ( Check_is_possible ( l , r , k ) ) cout << " YES STRNEWLINE " ; else cout << " NO STRNEWLINE " ; return 0 ; }