Number of unique rectangles formed using N unit squares | height >= length is maintained ; Driver code
< ? php function countRect ( $ n ) { $ ans = 0 ; for ( $ length = 1 ; $ length <= sqrt ( $ n ) ; $ length ++ ) for ( $ height = $ length ; $ height * $ length <= $ n ; $ height ++ ) $ ans ++ ; return $ ans ; } $ n = 5 ; echo countRect ( $ n ) ; ? >