text: Maximize count of sheets possible by repeatedly reducing its area to half | Function to calculate the maximum number of sheets possible by given operations ; Initial count of sheets ; Keep dividing the sheets into half ; Reduce area by half ; Increase count by twice ; Driver Code
code: function maxSheets ( A , B ) { let area = A * B ; let count = 1 ; while ( area % 2 == 0 ) { area /= 2 ; count *= 2 ; } return count ; } let A = 5 , B = 10 ; document . write ( maxSheets ( A , B ) ) ;