Number of unique rectangles formed using N unit squares | height >= length is maintained ; Driver code
function countRect ( n ) { let ans = 0 ; for ( let length = 1 ; length <= parseInt ( Math . sqrt ( n ) , 10 ) ; ++ length ) for ( let height = length ; height * length <= n ; ++ height ) ans ++ ; return ans ; } let n = 5 ; document . write ( countRect ( n ) ) ;