Timer is Running

Structs and Objects
Submissions: 3763   Accuracy:


  Difficulty: Easy   Marks: 2
Associated Course(s):   Fork CPP

CPP structs are more powerful than C structs as they are just classes with public data members. Here, we will create objects of a rectangle struct and find the maximum area of a rectangle.

Input Format:
The first line of input contains T denoting the number of testcases. T testcases follow. Each testcase contains two lines of input. The first line contains N denoting the number of rectangle objects to be created. The next line contains 2*N elements denoting the length and breadth of N rectangles.

Output Format:
For each testcase, in a new line, print the maximum area.

Your Task:
Since this is a function problem, you don't need to take any input. Just complete the area and maxArea functions.

1 <= T <= 100
1 <= length <= 100
1 <= breadth <= 100


9 8 7 6 5 4 3 2

Testcase1: We have N=4, so 4 rectangle objects.
Obj1 (9,8), Obj2(7,6), Obj3(5,4), Obj4(3,2)
Now area is length*breadth. So 9*8=72 gives maxArea

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

Author: Soul_xhacker

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.