Count of smaller rectangles that can be placed inside a bigger rectangle | Function to count smaller rectangles within the larger rectangle ; If the dimension of the smaller rectangle is greater than the bigger one ; Return the number of smaller rectangles possible ; Driver code ; Dimension of bigger rectangle ; Dimension of smaller rectangle ; Function call
def No_of_rectangles ( L , B , l , b ) : NEW_LINE INDENT if ( l > L ) or ( b > B ) : NEW_LINE INDENT return - 1 ; NEW_LINE DEDENT else : NEW_LINE INDENT return ( L - l + 1 ) * ( B - b + 1 ) ; NEW_LINE DEDENT DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT L = 5 NEW_LINE B = 3 NEW_LINE l = 4 NEW_LINE b = 1 NEW_LINE print ( No_of_rectangles ( L , B , l , b ) ) NEW_LINE DEDENT