A Cuboid is a 3-dimensional box-like figure represented in the 3-dimensional plane. A cuboid has 6 rectangle-shaped faces. Each face meets another face at 90 degrees each. Three sides of cuboid meet at the same vertex. Since it is made up of 6 rectangle faces, it has length, width and height of different dimension. Given the dimensions of the cuboid, find the Surface area and Volume of a cuboid. The formula’s to calculate the area and volume are given below.

**Examples:**

Input : 20 15 10 Output : Surface Area = 1300 Volume = 3000 Input : 30 5 10 Output : Surface Area = 1000 Volume = 1500

**Formulas:**

Volume = length * breadth * height

Surface Area of Cuboid = 2(length * breadth + breadth * height + height * length)

**Approach :**

- Given the dimensions of the cone, say length L, height H and breadth B of a cuboid.
- Calculate Volume and Surface Area

**Example 1:**

## Java

`// Java Program to Find the Volume and Surface Area of` `// Cuboids` ` ` `import` `java.io.*;` ` ` `class` `GFG {` ` ` `public` `static` `void` `main(String[] args)` ` ` `{` ` ` `// specify L,B and H` ` ` `double` `L = ` `20` `, B = ` `15` `, H = ` `10` `;` ` ` ` ` `// calculate SurfaceArea` ` ` `double` `SurfaceArea = ` `2` `* (L * B + B * H + H * L);` ` ` ` ` `// calculate Volume` ` ` `double` `Volume = L * B * H;` ` ` ` ` `System.out.println(` ` ` `"The Surface area of cuboid is : "` ` ` `+ SurfaceArea);` ` ` ` ` `System.out.println(` `"The Volume of the cuboid is : "` ` ` `+ Volume);` ` ` `}` `}` |

**Output**

The Surface area of cuboid is : 1300.0 The Volume of the cuboid is : 3000.0

**Example 2:**

## Java

`import` `java.io.*;` ` ` `class` `GFG {` ` ` `public` `static` `void` `main(String[] args)` ` ` `{` ` ` `// specify L,B and H` ` ` `double` `L = ` `30` `, B = ` `5` `, H = ` `10` `;` ` ` ` ` `// calculate SurfaceArea` ` ` `double` `SurfaceArea = ` `2` `* (L * B + B * H + H * L);` ` ` ` ` `// calculate Volume` ` ` `double` `Volume = L * B * H;` ` ` ` ` `System.out.println(` ` ` `"The Surface area of cuboid is : "` ` ` `+ SurfaceArea);` ` ` ` ` `System.out.println(` `"The Volume of the cuboid is : "` ` ` `+ Volume);` ` ` `}` `}` |

**Output**

The Surface area of cuboid is : 1000.0 The Volume of the cuboid is : 1500.0

**Time Complexity = **O(n)

Attention reader! Don’t stop learning now. Get hold of all the important **Java Foundation** and Collections concepts with the **Fundamentals of Java and Java Collections Course** at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer **Complete Interview Preparation Course****.**