Minimum number of square tiles required to fill the rectangular floor | Function to find the number of tiles ; if breadth is divisible by side of square ; tiles required is N / s ; one more tile required ; if length is divisible by side of square ; tiles required is M / s ; one more tile required ; input length and breadth of rectangle and side of square
< ? php function solve ( $ M , $ N , $ s ) { if ( $ N % $ s == 0 ) { $ N = $ N / $ s ; } else { $ N = ( $ N / $ s ) + 1 ; } if ( $ M % $ s == 0 ) { $ M = $ M / $ s ; } else { $ M = ( $ M / $ s ) + 1 ; } return ( int ) $ M * $ N ; } $ N = 12 ; $ M = 13 ; $ s = 4 ; echo solve ( $ M , $ N , $ s ) ; ? >