Rectangle Number
Submissions: 773   Accuracy:

52.78%

  Difficulty: Basic   Marks: 1

We are given a N*M grid, print the number of rectangles in it.

Examples:

Input  : N = 2, M = 2
Output : 9
There are 4 rectangles of size 1 x 1.
There are 2 rectangles of size 1 x 2
There are 2 rectangles of size 2 x 1
There is  1 rectangle of size 2 X 2.

Input  : N = 5, M = 4
Output : 150

Example : 
Input : 

The first line of input contains an integer T denoting the Test cases. Then T test cases follow. 
Second line contains N and M 

Output : 
Number of Rectangles. 

Constraints :
1 ≤ T ≤ 100
1 ≤ N M ≤ 100
Input : 
2
2 2 
5 4

Output : 
9
150
 

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Mohit Gupta_OMG :)
Author: support3


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.