text: Maximum number of 2 x2 squares that can be fit inside a right isosceles triangle | PHP program to count number of 2 x 2 squares in a right isosceles triangle ; removing the extra part we would always need ; Since each square has base of length of 2 ; Driver code
code: < ? php function numberOfSquares ( $ base ) { $ base = ( $ base - 2 ) ; $ base = intdiv ( $ base , 2 ) ; return $ base * ( $ base + 1 ) / 2 ; } $ base = 8 ; echo numberOfSquares ( $ base ) ; ? >