Number of ways N can be divided into four parts to construct a rectangle | C ++ implementation of the approach ; Function to return the required number of ways ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int cntWays ( int n ) { if ( n % 2 == 1 ) { return 0 ; } else { return ( n - 2 ) / 4 ; } } int main ( ) { int n = 18 ; cout << cntWays ( n ) ; return 0 ; }