Number of squares of side length required to cover an N * M rectangle | CPP program to find number of squares of a * a required to cover n * m rectangle ; function to find number of squares of a * a required to cover n * m rectangle ; Driver code ; function call
#include <bits/stdc++.h> NEW_LINE using namespace std ; int Squares ( int n , int m , int a ) { return ( ( m + a - 1 ) / a ) * ( ( n + a - 1 ) / a ) ; } int main ( ) { int n = 6 , m = 6 , a = 4 ; cout << Squares ( n , m , a ) ; return 0 ; }