- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Kotlin Program to Find the Surface Area and Volume of Cuboid

In this article, we will understand how to compute the surface area and volume the cuboid. The surface area of cuboid is calculated using the formula −

2*( length *width + width* height + height*length)

The Volume of the cuboid is calculated using the formula

length*width*height

Below is a demonstration of the same −

Suppose our input is −

length= 6; width= 7; height= 8;

The desired output would be −

Volume Of the Cuboid is : 336.0 Surface area Of the Cuboid is : 292.0

## Algorithm

**Step 1**− START**Step 2**− Declare five double values namely length, width, height, volume, surfaceArea**Step 3**− Define the values**Step 4**− Use the formula 2*( length *width + width* height + height*length) to calculate the surface area of cuboid**Step 5**− Use the formula length*width*height to calculate the area of the cuboid**Step 6**− Display the result**Step 7**− Stop

## Example 1

In this example, we will find the Volume and Surface Area of the cuboid using the length, width and height of the cuboid. First, declare and initialize the variables length, width and height −

val length = 6 val width = 7 val height = 8

Now, using the above formulae, find the Volume of Cuboid

val volume = length * width * height

In a similar way, find the Surface Area of Cuboid

val surfaceArea =2*( length * width + width * height + height * length);

Let us now see the final example to find the Volume and Surface Area of the cuboid −

fun main() { val length = 6 val width = 7 val height = 8 println("The length, width and height of the cuboid is defined as $length, $width and $height") val volume = length * width * height val surfaceArea =2*( length * width + width * height + height * length); println("The volume of the cuboid is: $volume") println("The surface area of the cuboid is: $surfaceArea") }

## Output

The length, width and height of the cuboid is defined as 6, 7 and 8 The volume of the cuboid is: 336 The surface area of the cuboid is: 292

## Example 2

In this example, we will find the Surface Area and Volume of Cuboid

fun main() { val length = 6 val width = 7 val height = 8 println("The length, width and height of the cuboid is defined as $length, $width and $height") cuboid(length, width, height) } fun cuboid(length: Int, width : Int, height : Int) { val volume = length * width * height val surfaceArea =2*( length * width + width * height + height * length); println("The volume of the cuboid is: $volume") println("The surface area of the cuboid is: $surfaceArea") }

## Output

The length, width and height of the cuboid is defined as 6, 7 and 8 The volume of the cuboid is: 336 The surface area of the cuboid is: 292

- Related Questions & Answers
- Java Program to Find the Surface area and Volume of Cuboid
- Program for Volume and Surface Area of Cuboid in C++
- Program for Volume and Surface Area of Cube in C++
- How to find Volume and Surface Area of a Sphere using C#?
- Find maximum volume of a cuboid from the given perimeter and area in C++
- Program for Volume and Surface area of Frustum of Cone in C++
- Surface Area and Volume of Hexagonal Prism in C programming
- Program to find the Area and Volume of Icosahedron in C++
- Program to calculate area and volume of a Tetrahedron
- Find the Surface area of a 3D figure in Python
- Program for Surface area of Dodecahedron in C++
- Program for Surface Area of Octahedron in C++
- Maximize volume of cuboid with given sum of sides in C++
- Surface Area of 3D Shapes in Python
- Program to find the Area and Perimeter of a Semicircle in C++
- C program to find the area of circle and cylinder using structures.