Minimum positive integer divisible by C and is not in range [ A , B ] | C ++ implementation of the approach ; Function to return the required number ; If doesn 't belong to the range  then c is the required number ; Else get the next multiple of c starting from b + 1 ; Driver code
#include <iostream> NEW_LINE using namespace std ; int getMinNum ( int a , int b , int c ) { if ( c < a c > b ) return c ; int x = ( ( b / c ) * c ) + c ; return x ; } int main ( ) { int a = 2 , b = 4 , c = 4 ; cout << getMinNum ( a , b , c ) ; return 0 ; }