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 ; Size of the bigger square ; Size of smaller square
function No_of_squares ( N , K ) { let no_of_squares = 0 ; no_of_squares = ( N - K + 1 ) * ( N - K + 1 ) ; return no_of_squares ; } let N = 5 ; let K = 3 ; document . write ( No_of_squares ( N , K ) ) ;