Count numbers less than N whose modulo with A is equal to B | Function to count numbers less than N , whose modulo with A gives B ; If the value of B at least A ; If the value of B is 0 or not ; Stores the resultant count of numbers less than N ; Update the value of ans ; Print the value of ans ; Driver Code
def countValues ( A , B , C ) : NEW_LINE INDENT if ( B >= A ) : NEW_LINE INDENT print ( 0 ) NEW_LINE return NEW_LINE DEDENT if ( B == 0 ) : NEW_LINE INDENT print ( C // A ) NEW_LINE return NEW_LINE DEDENT ans = C // A NEW_LINE if ( ans * A + B <= C ) : NEW_LINE INDENT ans += 1 NEW_LINE DEDENT print ( ans ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT A = 6 NEW_LINE B = 3 NEW_LINE N = 15 NEW_LINE countValues ( A , B , N ) NEW_LINE DEDENT