{"id":22983,"date":"2021-09-29T20:14:40","date_gmt":"2021-09-29T14:44:40","guid":{"rendered":"https:\/\/python-programs.com\/?p=22983"},"modified":"2021-11-22T18:35:35","modified_gmt":"2021-11-22T13:05:35","slug":"python-program-to-find-number-of-rectangles-in-nm-grid","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-find-number-of-rectangles-in-nm-grid\/","title":{"rendered":"Python Program to Find Number of Rectangles in N*M Grid"},"content":{"rendered":"

In the previous article, we have discussed Python Program for Minimum Perimeter of n Blocks<\/a>
\nGiven a grid of size N*M the task is to find the number of rectangles in the given grid in Python.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given N = 6\r\nGiven M = 4<\/pre>\n

Output:<\/strong><\/p>\n

Number of Rectangles in the grid of size { 6 * 4 } : 210<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given N = 4\r\nGiven M = 2<\/pre>\n

Output:<\/strong><\/p>\n

Number of Rectangles in the grid of size { 4 * 2 } : 30<\/pre>\n

Program to Find Number of Rectangles in N*M Grid in Python<\/h2>\n

Below are the ways to find the number of rectangles in the given N*M:<\/p>\n