Count squares of size K inscribed in a square of size N | Function to calculate the number of squares of size K in a square of size N ; Stores the number of squares ; Driver Code ; Size of the bigger square ; Size of smaller square
def No_of_squares ( N , K ) : NEW_LINE INDENT no_of_squares = 0 ; NEW_LINE no_of_squares = ( N - K + 1 ) * ( N - K + 1 ) ; NEW_LINE return no_of_squares ; NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT N = 5 ; NEW_LINE K = 3 ; NEW_LINE print ( No_of_squares ( N , K ) ) ; NEW_LINE DEDENT