C++ Function overloading
Submissions: 1134   Accuracy:


  Difficulty: Easy   Marks: 2

Gurkaran is fascinated on how can we know the exact volume of some objects just by knowing the some of their dimensions but he does not actually know how it actually works. Can you help him find the volume of a cube, a cylinder, and a rectangular box?

Note: Invest time in studying the locked code.

  • Take value of pie = 3.14519


First line contains the number of test cases

and each test case have a single line query where in each query first integer denotes if object given is a cube, cylinder or box and remaining integer in  the query denotes objects diamention.

1 represents cube

2 represents a cylinder

3 represents a rectangular box
All the integer values in a query are space separated.


The output should consist of single integer or double value (depending upon the object) which depicts the volume of that object.

1 <= t <= 100

0 <= diamentions <= 100

first number in a query = {1, 2, 3}  




1 2

2 1 2

3 1 2 3




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

Author: Archit18_PEC

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.