Number of rectangles in N * M grid | Python3 program to count number of rectangles in a n x m grid ; Driver code
def rectCount ( n , m ) : NEW_LINE INDENT return ( m * n * ( n + 1 ) * ( m + 1 ) ) // 4 NEW_LINE DEDENT n , m = 5 , 4 NEW_LINE print ( rectCount ( n , m ) ) NEW_LINE