Number of squares of side length required to cover an N * M rectangle | Java program to find number of squares of a * a required to cover n * m rectangle ; function to find a number of squares of a * a required to cover n * m rectangle ; Driver code ; function call
import java . util . * ; class solution { static int Squares ( int n , int m , int a ) { return ( ( m + a - 1 ) / a ) * ( ( n + a - 1 ) / a ) ; } public static void main ( String arr [ ] ) { int n = 6 , m = 6 , a = 4 ; System . out . println ( Squares ( n , m , a ) ) ; } }